pub struct Fibroblast<'a> { /* private fields */ }
Expand description

The whole shebang: both the (context-less) root tag and the context in which to decode it.

An instance of Fibroblast contains a RootTag, which contains the raw data, as well as a DecodingContext, which contains the context in which to decode this data (necessary to e.g., resolve paths referenced by tags).

Serialization and deserialization are implemented for all tag-like types. For most tag-like types, #[derive(Serialize, Deserialize)] is sufficient to adopt the correct behavior.

CAUTION: For simplicity, AnyChildTag uses serde’s untagged deserialization option. This means that the choice of variant into which a map will be decoded is determined entirely by the map’s keys. For instance, the presence of the "image_path" key will cause the tag to be decoded into an ImageTag. Therefore, when defining a new kind of child tag, you must ensure that the set of fields required to deserialize it neither contains nor is contained by the set of required fields of any other child tag; otherwise deserialization will be ambiguous.1 Note that a struct’s set of required fields may be quite small, so be mindful when choosing names for keys. (In practice, if you pick reasonably descriptive English names, there shouldn’t be overlap.)

1 Technically, it’s not ambiguous; serde picks the first variant for which deserialization succeeds, so it depends on the order of the variants of AnyChildTag.


  1.  

Implementations§

source§

impl<'a> Fibroblast<'a>

source

pub fn from_dir(path: PathBuf) -> ClgnDecodingResult<Self>

source

pub fn from_dir_with_context( path: impl AsRef<Path>, context: DecodingContext<'a> ) -> ClgnDecodingResult<Self>

source§

impl<'a> Fibroblast<'a>

source

pub fn to_svg( &'a self, writer: &mut XmlWriter<impl Write> ) -> ClgnDecodingResult<()>

Trait Implementations§

source§

impl<'a> Clone for Fibroblast<'a>

source§

fn clone(&self) -> Fibroblast<'a>

Returns a copy 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<'a> Debug for Fibroblast<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Fibroblast<'a>

§

impl<'a> Send for Fibroblast<'a>

§

impl<'a> !Sync for Fibroblast<'a>

§

impl<'a> Unpin for Fibroblast<'a>

§

impl<'a> UnwindSafe for Fibroblast<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.