pub struct RustShape { /* private fields */ }Expand description
Interprets a shape as a Rust layout whose serialization writes names this way.
A field is named in snake case, as Rust names one, and the spelling the surface writes is stated once for the whole declaration — which is available to state because the term carries words and not a spelling.
Implementations§
Source§impl RustShape
impl RustShape
Sourcepub fn known(self, words: Words<'_>, path: impl Into<String>) -> Self
pub fn known(self, words: Words<'_>, path: impl Into<String>) -> Self
States that a name is already a type here, and what it is called.
A domain’s leaves are not the primitives they are written as: two of them may share
int(false, 64) and remain different types. A name is what tells them apart, so a name this
host already has a type for is written as that type rather than declared again.
Trait Implementations§
Source§impl ShapeAlg for RustShape
impl ShapeAlg for RustShape
Source§fn literal(&self, _text: &str) -> Layout
fn literal(&self, _text: &str) -> Layout
Source§fn name_word(&self, _words: Words<'_>) -> Layout
fn name_word(&self, _words: Words<'_>) -> Layout
Source§fn hex(&self, item: Layout) -> Layout
fn hex(&self, item: Layout) -> Layout
0x-prefixed hexadecimal, rather than however the item would appear alone.Source§fn decimal(&self, item: Layout) -> Layout
fn decimal(&self, item: Layout) -> Layout
Source§fn choice(&self, alternatives: Vec<Layout>) -> Layout
fn choice(&self, alternatives: Vec<Layout>) -> Layout
Auto Trait Implementations§
impl Freeze for RustShape
impl RefUnwindSafe for RustShape
impl Send for RustShape
impl Sync for RustShape
impl Unpin for RustShape
impl UnsafeUnpin for RustShape
impl UnwindSafe for RustShape
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<This> ShapeDeclareExt<This> for This
impl<This> ShapeDeclareExt<This> for This
Source§impl<This> ShapeExt<This> for Thiswhere
This: ShapeAlg,
impl<This> ShapeExt<This> for Thiswhere
This: ShapeAlg,
Source§fn bytes_array(&self) -> <This as Sorts>::Ty
fn bytes_array(&self) -> <This as Sorts>::Ty
Bytes written as an array of JSON numbers, which is a sequence of octets and nothing more.
Source§fn int_decimal(&self, signed: bool, bits: u16) -> <This as Sorts>::Ty
fn int_decimal(&self, signed: bool, bits: u16) -> <This as Sorts>::Ty
An integer written as decimal digits, for a width a JSON number cannot hold.
Source§fn int_hex(&self, signed: bool, bits: u16) -> <This as Sorts>::Ty
fn int_hex(&self, signed: bool, bits: u16) -> <This as Sorts>::Ty
An integer written as a 0x quantity, as the Ethereum JSON-RPC specification states one.
Source§fn named_product(
&self,
words: &[&str],
fields: Vec<<This as Sorts>::Field>,
) -> <This as Sorts>::Ty
fn named_product( &self, words: &[&str], fields: Vec<<This as Sorts>::Field>, ) -> <This as Sorts>::Ty
A named product: the shape most types have.
Source§impl<This> ShapeProgramExt<This> for This
impl<This> ShapeProgramExt<This> for This
Source§fn compile_shape<Program>(
&self,
program: Program,
) -> <Program as ShapeProgramAlg<This>>::Tywhere
Program: ShapeProgramAlg<This>,
fn compile_shape<Program>(
&self,
program: Program,
) -> <Program as ShapeProgramAlg<This>>::Tywhere
Program: ShapeProgramAlg<This>,
Folds a declaration with this interpretation.
Source§impl<This> ShapeTaggedExt<This> for This
impl<This> ShapeTaggedExt<This> for This
Source§fn sum_external<'w>(
&self,
alternatives: Vec<(&'w [&'w str], <This as Sorts>::Ty)>,
) -> <This as Sorts>::Ty
fn sum_external<'w>( &self, alternatives: Vec<(&'w [&'w str], <This as Sorts>::Ty)>, ) -> <This as Sorts>::Ty
A choice written as one object per alternative, keyed by its name.