pub trait Shaped: Sized + 'static {
const FORM: WireForm;
// Required methods
fn write_at(
&self,
out: &mut ValueWriter<'_, '_>,
ty: &Type,
) -> Result<(), EncodeError>;
fn read_at(
input: &mut ValueReader<'_, '_, '_>,
ty: &Type,
) -> Result<Self, DecodeError>;
}Expand description
A Rust type mapped to a Flow type: its WireForm, and its values
written and read at the Flow type its form projects to, part by part,
as the value encoding has them.
Required Associated Constants§
Required Methods§
Sourcefn write_at(
&self,
out: &mut ValueWriter<'_, '_>,
ty: &Type,
) -> Result<(), EncodeError>
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
Writes it as a value of ty, the Flow type its form projects to in
out’s catalog.
§Errors
An EncodeError when its form has no Flow type, ty is not that
type, or the value is out of a form its type holds it to.
Sourcefn read_at(
input: &mut ValueReader<'_, '_, '_>,
ty: &Type,
) -> Result<Self, DecodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Self, DecodeError>
Reads one, a value of ty in input’s catalog.
§Errors
A DecodeError when ty is not the type its form projects to, or
the bytes are not a value of ty that is one of its own.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Shaped for !
Never, which has no values.
impl Shaped for !
Never, which has no values.
const FORM: WireForm = WireForm::Never
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<!, DecodeError>
Source§impl Shaped for ()
impl Shaped for ()
const FORM: WireForm = WireForm::Unit
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<(), DecodeError>
Source§impl Shaped for Bytes
impl Shaped for Bytes
const FORM: WireForm = WireForm::Bytes
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Bytes, DecodeError>
Source§impl Shaped for Call
impl Shaped for Call
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Call, DecodeError>
Source§impl Shaped for Duration
duration.Duration, as a length its Rust type can hold: one that is
negative or finer than a nanosecond is none.
impl Shaped for Duration
duration.Duration, as a length its Rust type can hold: one that is
negative or finer than a nanosecond is none.
const FORM: WireForm = WireForm::Duration
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Duration, DecodeError>
Source§impl Shaped for Flags
impl Shaped for Flags
const FORM: WireForm
fn write_at( &self, catalog: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( catalog: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Flags, DecodeError>
Source§impl Shaped for Log
impl Shaped for Log
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Log, DecodeError>
Source§impl Shaped for Message
impl Shaped for Message
const FORM: WireForm
fn write_at( &self, catalog: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( catalog: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Message, DecodeError>
Source§impl Shaped for OsString
An OS string is written as its bytes, as Bytes is, never through a
lossy text: the platform’s own encoding of it, which off Unix is a superset
of UTF-8. Off Unix it reads back only when those bytes are UTF-8, and is
refused otherwise.
impl Shaped for OsString
An OS string is written as its bytes, as Bytes is, never through a
lossy text: the platform’s own encoding of it, which off Unix is a superset
of UTF-8. Off Unix it reads back only when those bytes are UTF-8, and is
refused otherwise.
const FORM: WireForm = WireForm::Bytes
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<OsString, DecodeError>
Source§impl Shaped for PathBuf
path.Path: its normal text, its components joined by / whatever
the host’s separator, so a path that is not UTF-8 is none.
impl Shaped for PathBuf
path.Path: its normal text, its components joined by / whatever
the host’s separator, so a path that is not UTF-8 is none.
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<PathBuf, DecodeError>
Source§impl Shaped for Reply
impl Shaped for Reply
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Reply, DecodeError>
Source§impl Shaped for String
impl Shaped for String
const FORM: WireForm = WireForm::Text
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<String, DecodeError>
Source§impl Shaped for SystemTime
time.Instant, as an instant the platform’s clock can hold.
impl Shaped for SystemTime
time.Instant, as an instant the platform’s clock can hold.
const FORM: WireForm = WireForm::Instant
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<SystemTime, DecodeError>
Source§impl Shaped for bool
impl Shaped for bool
const FORM: WireForm = WireForm::Bool
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<bool, DecodeError>
Source§impl Shaped for u64
impl Shaped for u64
const FORM: WireForm = WireForm::Number
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<u64, DecodeError>
Source§impl<A, B, C, D, E, F, G, H> Shaped for (A, B, C, D, E, F, G, H)
impl<A, B, C, D, E, F, G, H> Shaped for (A, B, C, D, E, F, G, H)
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<(A, B, C, D, E, F, G, H), DecodeError>
Source§impl<A, B, C, D, E, F, G> Shaped for (A, B, C, D, E, F, G)
impl<A, B, C, D, E, F, G> Shaped for (A, B, C, D, E, F, G)
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<(A, B, C, D, E, F, G), DecodeError>
Source§impl<A, B, C, D, E, F> Shaped for (A, B, C, D, E, F)
impl<A, B, C, D, E, F> Shaped for (A, B, C, D, E, F)
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<(A, B, C, D, E, F), DecodeError>
Source§impl<A, B, C, D, E> Shaped for (A, B, C, D, E)
impl<A, B, C, D, E> Shaped for (A, B, C, D, E)
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<(A, B, C, D, E), DecodeError>
Source§impl<A, B, C, D> Shaped for (A, B, C, D)
impl<A, B, C, D> Shaped for (A, B, C, D)
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<(A, B, C, D), DecodeError>
Source§impl<A, B, C> Shaped for (A, B, C)
impl<A, B, C> Shaped for (A, B, C)
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<(A, B, C), DecodeError>
Source§impl<A, B> Shaped for (A, B)
impl<A, B> Shaped for (A, B)
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<(A, B), DecodeError>
Source§impl<K, V> Shaped for BTreeMap<K, V>
A dictionary, its entries in Flow’s order of its keys whatever Rust’s is.
impl<K, V> Shaped for BTreeMap<K, V>
A dictionary, its entries in Flow’s order of its keys whatever Rust’s is.
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<BTreeMap<K, V>, DecodeError>
Source§impl<T, E> Shaped for Result<T, E>
std’s Result: Ok then Err, as std declares them, whichever
numbers a catalog gives them.
impl<T, E> Shaped for Result<T, E>
std’s Result: Ok then Err, as std declares them, whichever
numbers a catalog gives them.
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Result<T, E>, DecodeError>
Source§impl<T> Shaped for BTreeSet<T>
A set, its values in Flow’s order whatever Rust’s is.
impl<T> Shaped for BTreeSet<T>
A set, its values in Flow’s order whatever Rust’s is.
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<BTreeSet<T>, DecodeError>
Source§impl<T> Shaped for Box<T>where
T: Shaped,
impl<T> Shaped for Box<T>where
T: Shaped,
const FORM: WireForm = T::FORM
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Box<T>, DecodeError>
Source§impl<T> Shaped for Option<T>where
T: Shaped,
impl<T> Shaped for Option<T>where
T: Shaped,
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Option<T>, DecodeError>
Source§impl<T> Shaped for Vec<T>where
T: Shaped,
impl<T> Shaped for Vec<T>where
T: Shaped,
const FORM: WireForm
fn write_at( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
fn read_at( input: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Vec<T>, DecodeError>
Source§impl<const N: usize> Shaped for [u8; N]
A run of exactly N bytes, written as Bytes are: a run of any other
length is not one.
impl<const N: usize> Shaped for [u8; N]
A run of exactly N bytes, written as Bytes are: a run of any other
length is not one.
Implementors§
Source§impl Shaped for Encoded
Its form is never read: #[tool] declares a type parameter by its
place-holder, flow_abi::wire::Param, and the derive of a std
declaration writes the declaration’s form.
impl Shaped for Encoded
Its form is never read: #[tool] declares a type parameter by its
place-holder, flow_abi::wire::Param, and the derive of a std
declaration writes the declaration’s form.
Source§impl Shaped for flow_abi::metadata::ResultType
As TypeSpec’s: the bytes it was read from, read and validated by
ResultType::read_from.
impl Shaped for flow_abi::metadata::ResultType
As TypeSpec’s: the bytes it was read from, read and validated by
ResultType::read_from.
Source§impl Shaped for ToolProblem
std’s ToolProblem, its constructors found by name in the enum the
catalog declares.
impl Shaped for ToolProblem
std’s ToolProblem, its constructors found by name in the enum the
catalog declares.
Source§impl Shaped for flow_abi::metadata::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 flow_abi::metadata::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§impl Shaped for UnixMillis
A time is written as the value encoding writes an Instant, which is
how a note keeps one (trace.md, Host notes): an Instant that is not
a whole number of milliseconds in the range is no such time.
impl Shaped for UnixMillis
A time is written as the value encoding writes an Instant, which is
how a note keeps one (trace.md, Host notes): an Instant that is not
a whole number of milliseconds in the range is no such time.