pub struct GlifComponents {
pub root: String,
pub vec: Vec<GlifComponent>,
pub uniques: HashSet<String>,
}
Expand description
A container meant for yelding a Forest<Component<PD>>
.
Please see impl From<GlifComponents> for Result<Forest<Component<PD>>, GlifParserError>
.
Fields§
§root: String
§vec: Vec<GlifComponent>
§uniques: HashSet<String>
Implementations§
Source§impl GlifComponents
Builds a tree of components in a recursive manner. It takes a mutable reference to a HashSet
called uniques
, which keeps track of the unique component names seen so far in the current
subtree. This prevents cycles from occurring.
impl GlifComponents
Builds a tree of components in a recursive manner. It takes a mutable reference to a HashSet
called uniques
, which keeps track of the unique component names seen so far in the current
subtree. This prevents cycles from occurring.
If a loop is found in the tree (for example, gershayim refers to grave refers to grave), an
error is returned with the appropriate message. The error type is
GlifParserError::GlifComponentsCyclical
, which takes a formatted string to provide more
details about the error.
Sourcepub fn build_component_tree<PD: PointData>(
&mut self,
component: Component<PD>,
) -> Result<Tree<Component<PD>>, GlifParserError>
pub fn build_component_tree<PD: PointData>( &mut self, component: Component<PD>, ) -> Result<Tree<Component<PD>>, GlifParserError>
You should not need to call this function directly; see § Conversion.
Trait Implementations§
Source§impl Clone for GlifComponents
impl Clone for GlifComponents
Source§fn clone(&self) -> GlifComponents
fn clone(&self) -> GlifComponents
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for GlifComponents
impl Debug for GlifComponents
Source§impl Default for GlifComponents
impl Default for GlifComponents
Source§fn default() -> GlifComponents
fn default() -> GlifComponents
Source§impl<'de> Deserialize<'de> for GlifComponents
impl<'de> Deserialize<'de> for GlifComponents
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<PD: PointData> From<GlifComponents> for Result<Forest<Component<PD>>, GlifParserError>
§Conversion
This impl builds up a forest of trees for a glyph’s components. Imagine a hungarumlaut (˝).
impl<PD: PointData> From<GlifComponents> for Result<Forest<Component<PD>>, GlifParserError>
§Conversion
This impl builds up a forest of trees for a glyph’s components. Imagine a hungarumlaut (˝).
This character may be built of glyph components, as such:
hungarumlaut
/ \
/ \
grave grave
| |
acute acute
This function will give you a Forest of both of the sub-trees. (Forest<Component>
). The elements
of a Forest
are Tree<Component>
. For safety reasons, this function cannot always return a
Forest
. Sometimes, .glif files can be malformed, containing components which refer to
themselves or to components higher up the tree.
Source§fn from(glifcs: GlifComponents) -> Self
fn from(glifcs: GlifComponents) -> Self
Source§impl PartialEq for GlifComponents
impl PartialEq for GlifComponents
Source§impl Serialize for GlifComponents
impl Serialize for GlifComponents
impl StructuralPartialEq for GlifComponents
Auto Trait Implementations§
impl Freeze for GlifComponents
impl RefUnwindSafe for GlifComponents
impl Send for GlifComponents
impl Sync for GlifComponents
impl Unpin for GlifComponents
impl UnwindSafe for GlifComponents
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more