pub struct CodecMember { /* private fields */ }Expand description
One member of a declared shape: what the owner calls it, the type it is held at, how it is written, and how many of it there are.
§Bounds
The spelling is one Rust identifier by construction, because the decode road binds a local under it and the encode road reads a field under it — and a spelling that is not one renders tokens the caller’s compiler reads as something else.
Implementations§
Source§impl CodecMember
impl CodecMember
Sourcepub fn declared(
spelling: &str,
held_as: CodecTypePath,
shape: CodecMemberShape,
cardinality: Cardinality,
) -> Result<Self, CodecError>
pub fn declared( spelling: &str, held_as: CodecTypePath, shape: CodecMemberShape, cardinality: Cardinality, ) -> Result<Self, CodecError>
Declare one member of a shape.
§Errors
Returns CodecIssue::MemberSpellingAbsent where the member states no spelling, and CodecIssue::MemberSpellingNotAnIdentifier where the spelling cannot name a rendered item — not one Rust identifier, or a keyword the language already took.
The two are dependent — there is no alphabet to read until there are characters — so exactly one is ever established.
Sourcepub const fn held_as(&self) -> &CodecTypePath
pub const fn held_as(&self) -> &CodecTypePath
The type ONE OCCURRENCE of this member is held at, never the collection or the option a cardinality wraps it in.
Sourcepub const fn shape(&self) -> CodecMemberShape
pub const fn shape(&self) -> CodecMemberShape
How this member is written.
Sourcepub const fn cardinality(&self) -> Cardinality
pub const fn cardinality(&self) -> Cardinality
How many of this member there are.
Trait Implementations§
Source§impl Clone for CodecMember
impl Clone for CodecMember
Source§fn clone(&self) -> CodecMember
fn clone(&self) -> CodecMember
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more