Struct collagen::fibroblast::Fibroblast
source · 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
.
Implementations§
source§impl<'a> Fibroblast<'a>
impl<'a> Fibroblast<'a>
pub fn from_dir(path: PathBuf) -> ClgnDecodingResult<Self>
pub fn from_dir_with_context( path: impl AsRef<Path>, context: DecodingContext<'a> ) -> ClgnDecodingResult<Self>
source§impl<'a> Fibroblast<'a>
impl<'a> Fibroblast<'a>
Trait Implementations§
source§impl<'a> Clone for Fibroblast<'a>
impl<'a> Clone for Fibroblast<'a>
source§fn clone(&self) -> Fibroblast<'a>
fn clone(&self) -> Fibroblast<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more