pub struct TypeSpec { /* private fields */ }Expand description
A Tool’s type description: its roots and the templates they reach, in first-reach order, validated.
Implementations§
Source§impl TypeSpec
impl TypeSpec
Sourcepub fn from_catalog(
catalog: &Catalog,
signature: &Signature,
) -> Result<Self, EncodeError>
pub fn from_catalog( catalog: &Catalog, signature: &Signature, ) -> Result<Self, EncodeError>
The description of signature, whose types catalog names.
§Errors
An EncodeError when a type the signature reaches has no term,
such as an incomplete one, or the description does not validate.
Sourcepub fn read(bytes: &[u8]) -> Result<Self, DecodeError>
pub fn read(bytes: &[u8]) -> Result<Self, DecodeError>
The description bytes hold, and nothing else.
§Errors
A DecodeError when the bytes are not one valid TypeSpec.
Sourcepub fn read_from(reader: &mut Reader<'_>) -> Result<Self, DecodeError>
pub fn read_from(reader: &mut Reader<'_>) -> Result<Self, DecodeError>
The description at reader, which it reads past.
§Errors
A DecodeError when the bytes there are not a valid TypeSpec.
Sourcepub fn catalog(&self) -> &Catalog
pub fn catalog(&self) -> &Catalog
The catalog of the declarations its roots reach, each DeclId its
place in the description.
Sourcepub fn signature(&self) -> &Signature
pub fn signature(&self) -> &Signature
The served signature: its parameters and result, with Type::Param
counting its type parameters.
Sourcepub fn comparable(&self) -> Vec<u8> ⓘ
pub fn comparable(&self) -> Vec<u8> ⓘ
The description written to be compared: every doc comment None
and every version empty.
§Panics
Never: a description that was read is written again.
Sourcepub fn outline(&self) -> String
pub fn outline(&self) -> String
The signature as a message writes it when two differ: each parameter and the result, then each template’s members, docs and versions left out.
§Panics
Never: a validated template’s arity fits 32 bits.
Sourcepub fn validate_call(
&self,
generic: Option<&CallTypes>,
) -> Result<Option<ValidatedTypes>, DecodeError>
pub fn validate_call( &self, generic: Option<&CallTypes>, ) -> Result<Option<ValidatedTypes>, DecodeError>
Validates a call’s views against this description (abi.md, A
generic call’s types): none for a Tool that is not generic, and for
a generic one a CallTypes whose bindings, parameters and result
agree with this spec.
§Errors
A DecodeError when the views are missing or extra, are not a
valid CallTypes, or do not fit this spec.
Trait Implementations§
impl Eq for TypeSpec
Source§impl Shaped for TypeSpec
A validated description is written as the bytes it was read from, and read
as TypeSpec::read_from reads and validates it; its form and its value
are its declared description’s.
impl Shaped for TypeSpec
A validated description is written as the bytes it was read from, and read
as TypeSpec::read_from reads and validates it; its form and its value
are its declared description’s.
Source§fn write_at(
&self,
out: &mut ValueWriter<'_, '_>,
ty: &Type,
) -> Result<(), EncodeError>
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
Source§fn read_at(
input: &mut ValueReader<'_, '_, '_>,
ty: &Type,
) -> Result<Self, DecodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Self, DecodeError>
Source§impl Wire for TypeSpec
impl Wire for TypeSpec
Source§fn write_head<'a>(&'a self, out: &mut Vec<u8>, _: &mut Vec<&'a dyn AnyWire>)
fn write_head<'a>(&'a self, out: &mut Vec<u8>, _: &mut Vec<&'a dyn AnyWire>)
out, and pushes
its parts to parts in the order they are written after them.Source§fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>
fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>
reader: the value itself when it has no parts,
else its parts to read and what joins them. Read moreSource§fn write(&self, out: &mut Vec<u8>)
fn write(&self, out: &mut Vec<u8>)
out: its head, and then each part’s bytes in
order, written over a stack on the heap, so a value nested however
deep is written on a native stack of fixed size.Auto Trait Implementations§
impl !Freeze for TypeSpec
impl Forget for TypeSpec
impl Move for TypeSpec
impl RefUnwindSafe for TypeSpecwhere
Atomic<usize>: RefUnwindSafe,
Mutex<HashMap<(Type, Settings), Option<String>>>: RefUnwindSafe,
impl Send for TypeSpec
impl Sync for TypeSpec
impl Unpin for TypeSpec
impl UnsafeUnpin for TypeSpecwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Decl>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
PhantomData<((Type, Settings), Option<String>)>: UnsafeUnpin,
PhantomData<Names>: UnsafeUnpin,
*const ArcInner<EnumShape> is !null: UnsafeUnpin,
PhantomData<ArcInner<EnumShape>>: UnsafeUnpin,
*const [usize] is !null: UnsafeUnpin,
PhantomData<[usize]>: UnsafeUnpin,
*const [Option<OptionCtor>] is !null: UnsafeUnpin,
PhantomData<[Option<OptionCtor>]>: UnsafeUnpin,
*const [Option<JsonValueCtor>] is !null: UnsafeUnpin,
PhantomData<[Option<JsonValueCtor>]>: UnsafeUnpin,
PhantomData<(String, Type)>: UnsafeUnpin,
*const Type is !null: UnsafeUnpin,
PhantomData<Type>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const ArcInner<[u8]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[u8]>>: UnsafeUnpin,
impl UnwindSafe for TypeSpecwhere
RawVecInner: UnwindSafe,
Arc<RecordShape>: UnwindSafe,
BoxRaw<Type>: UnwindSafe,
Arc<EnumShape>: UnwindSafe,
Mutex<HashMap<(Type, Settings), Option<String>>>: UnwindSafe,
HashMap<Box<str>, usize>: UnwindSafe,
BoxRaw<[usize]>: UnwindSafe,
BoxRaw<[Option<OptionCtor>]>: UnwindSafe,
BoxRaw<[Option<JsonValueCtor>]>: UnwindSafe,
Arc<[u8]>: UnwindSafe,
Blanket Implementations§
Source§impl<T> AnyWire for Twhere
T: Wire,
impl<T> AnyWire for Twhere
T: Wire,
Source§fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
Wire::write_head.