Skip to main content

Prefixed

Struct Prefixed 

Source
pub struct Prefixed<A> { /* private fields */ }
Expand description

A shape whose names all begin with one word.

What keeps two surfaces’ declarations apart where both are emitted into one place, without either surface stating anything about the other.

Implementations§

Source§

impl<A> Prefixed<A>

Source

pub fn new(inner: A, word: &'static str) -> Self

Puts word before every name this shape states.

Trait Implementations§

Source§

impl<A: Clone> Clone for Prefixed<A>

Source§

fn clone(&self) -> Prefixed<A>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Copy> Copy for Prefixed<A>

Source§

impl<A: Debug> Debug for Prefixed<A>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<A> FieldAlg for Prefixed<A>
where A: ShapeAlg + FieldAlg,

Source§

fn field(&self, words: Words<'_>, shape: A::Ty) -> A::Field

A member under the name it is written with.
Source§

fn merge(&self, shape: A::Ty) -> A::Field

Another product’s members, observed as this product’s own. Read more
Source§

impl<A> ShapeAlg for Prefixed<A>
where A: ShapeAlg,

Source§

fn truth(&self) -> A::Ty

A boolean.
Source§

fn unit(&self) -> A::Ty

The empty value: null, or an absent member.
Source§

fn text(&self) -> A::Ty

Text.
Source§

fn literal(&self, text: &str) -> A::Ty

One fixed piece of text, as a value: content that happens to be constant.
Source§

fn name_word(&self, words: Words<'_>) -> A::Ty

A value whose content is a name, spelled however the interpretation spells names. Read more
Source§

fn int(&self, signed: bool, bits: u16) -> A::Ty

An integer of a stated width and signedness.
Source§

fn float(&self, bits: u16) -> A::Ty

A floating-point number of a stated width.
Source§

fn bytes(&self, len: Option<usize>) -> A::Ty

Opaque bytes, of a stated length when fixed.
Source§

fn hex(&self, item: A::Ty) -> A::Ty

Written as 0x-prefixed hexadecimal, rather than however the item would appear alone.
Source§

fn decimal(&self, item: A::Ty) -> A::Ty

Written as decimal digits in text, which is what a width beyond a JSON number requires.
Source§

fn base64(&self, item: A::Ty) -> A::Ty

Written as base64 text.
Source§

fn opt(&self, item: A::Ty) -> A::Ty

A value that may be absent.
Source§

fn seq(&self, item: A::Ty) -> A::Ty

An ordered sequence of one shape.
Source§

fn map(&self, key: A::Ty, value: A::Ty) -> A::Ty

An association from one shape to another.
Source§

fn product(&self, fields: Vec<A::Field>) -> A::Ty

A product of members.
Source§

fn choice(&self, alternatives: Vec<A::Ty>) -> A::Ty

A choice between alternatives, carrying no discriminant of its own. Read more
Source§

fn named(&self, words: Words<'_>, body: A::Ty) -> A::Ty

Introduces a name for a shape, so an interpretation can state it once. Read more
Source§

fn reference(&self, words: Words<'_>) -> A::Ty

Uses a name introduced elsewhere, which is what makes recursion expressible.
Source§

impl<A> Sorts for Prefixed<A>
where A: Sorts,

Source§

type Ty = <A as Sorts>::Ty

A shape.
Source§

type Field = <A as Sorts>::Field

One member of a product.

Auto Trait Implementations§

§

impl<A> Freeze for Prefixed<A>
where A: Freeze,

§

impl<A> RefUnwindSafe for Prefixed<A>
where A: RefUnwindSafe,

§

impl<A> Send for Prefixed<A>
where A: Send,

§

impl<A> Sync for Prefixed<A>
where A: Sync,

§

impl<A> Unpin for Prefixed<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for Prefixed<A>
where A: UnsafeUnpin,

§

impl<A> UnwindSafe for Prefixed<A>
where A: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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<This> ShapeDeclareExt<This> for This
where This: ShapeAlg + FieldAlg,

Source§

fn record<'a>(&'a self, words: &'a [&'a str]) -> Record<'a, This>

Opens the product a declaration states, under the name the declaration carries.

Source§

fn program<Program>(&self, program: Program) -> <This as Sorts>::Ty
where Program: ShapeProgramAlg<This, Ty = <This as Sorts>::Ty>,

The shape another declaration states, folded here.

Source§

impl<This> ShapeExt<This> for This
where This: ShapeAlg,

Source§

fn bytes_hex(&self, len: Option<usize>) -> <This as Sorts>::Ty

Bytes written as hexadecimal.

Source§

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

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

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

A named product: the shape most types have.

Source§

fn sum_untagged<'w>( &self, alternatives: Vec<(&'w [&'w str], <This as Sorts>::Ty)>, ) -> <This as Sorts>::Ty

A choice written as the alternative’s value alone, with no discriminant on the wire.

Source§

fn sum_of_names<'w>(&self, names: Vec<&'w [&'w str]>) -> <This as Sorts>::Ty

A choice between names alone, which is a choice between name-valued constants.

Source§

impl<This> ShapeProgramExt<This> for This

Source§

fn compile_shape<Program>( &self, program: Program, ) -> <Program as ShapeProgramAlg<This>>::Ty
where Program: ShapeProgramAlg<This>,

Folds a declaration with this interpretation.

Source§

impl<This> ShapeTaggedExt<This> for This
where This: ShapeAlg + FieldAlg,

Source§

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.

Source§

fn sum_internal<'w>( &self, tag: &'w [&'w str], alternatives: Vec<(&'w [&'w str], <This as Sorts>::Ty)>, ) -> <This as Sorts>::Ty

A choice written as one object carrying its name under tag, beside its own members.

Source§

fn sum_adjacent<'w>( &self, tag: &'w [&'w str], content: &'w [&'w str], alternatives: Vec<(&'w [&'w str], <This as Sorts>::Ty)>, ) -> <This as Sorts>::Ty

A choice written as one object carrying its name under tag and its value under content.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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

Source§

type Error = !

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

Source§

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.