HancomStyleSet

Enum HancomStyleSet 

Source
#[non_exhaustive]
pub enum HancomStyleSet { Classic, Modern, Latest, }
Expand description

The set of default styles to inject when building an HWPX file.

Different versions of 한글 ship with different built-in style tables. Choosing the wrong set causes style ID mismatches, which can break automatic numbering, table-of-contents generation, and other features.

§Variant ordering

Use HancomStyleSet::Modern (the default) unless you are targeting files for 한글 2020 or earlier (Classic) or 한글 2025+ (Latest).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Classic

18 built-in styles — 한글 2014 through 2020.

개요 8–10 are absent; 쪽 번호 is at ID 9.

§

Modern

22 built-in styles — 한글 2022 and later.

개요 8–10 are inserted at IDs 9–11, shifting 쪽 번호 to ID 12. 캡션 (Caption) style is added at ID 21.

This is the default variant because 한글 2022+ is now the most widely deployed version.

§

Latest

23 built-in styles — 한글 2025 and later.

Same as Modern with the addition of 줄 번호 (Line Number) at ID 22.

Implementations§

Source§

impl HancomStyleSet

Source

pub fn default_styles(&self) -> &'static [DefaultStyleEntry]

Returns the complete ordered default-style array for this version.

The slice index corresponds directly to the id attribute that must be written to <hh:style id="…"> in header.xml.

Source

pub fn count(&self) -> usize

Returns the number of default styles for this version.

Equivalent to self.default_styles().len().

Source

pub fn style_id_for_name(&self, name: &str) -> Option<usize>

Looks up the style index for a given Korean or English style name.

Returns None if no matching default style is found in this version’s style table. The returned index corresponds directly to the styleIDRef attribute in HWPX <hp:p> elements.

§Examples
use hwpforge_smithy_hwpx::default_styles::HancomStyleSet;

assert_eq!(HancomStyleSet::Modern.style_id_for_name("개요 1"), Some(2));
assert_eq!(HancomStyleSet::Modern.style_id_for_name("Outline 1"), Some(2));
assert_eq!(HancomStyleSet::Modern.style_id_for_name("바탕글"), Some(0));
assert_eq!(HancomStyleSet::Modern.style_id_for_name("unknown"), None);

Trait Implementations§

Source§

impl Clone for HancomStyleSet

Source§

fn clone(&self) -> HancomStyleSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HancomStyleSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HancomStyleSet

Source§

fn default() -> HancomStyleSet

Returns the “default value” for a type. Read more
Source§

impl PartialEq for HancomStyleSet

Source§

fn eq(&self, other: &HancomStyleSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for HancomStyleSet

Source§

impl Eq for HancomStyleSet

Source§

impl StructuralPartialEq for HancomStyleSet

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.