Writable

Trait Writable 

Source
pub trait Writable<O: Output> {
    // Required method
    async fn write_to(&self, output: &mut O) -> Result<(), O::Error>;
}
Expand description

A type that can be written to an output stream.

This struct is typically implemented by generic structs whenever their fields are also Writable. In this way, writable types depend on each other and re-use common syntax.

Required Methods§

Source

async fn write_to(&self, output: &mut O) -> Result<(), O::Error>

Writes to the output. Returns the output’s error upon failure.

A writable can always be written multiple times. Because of this, the function takes a borrowed reference.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'w, W, O> Writable<O> for &'w W
where W: Writable<O>, O: Output,

Source§

async fn write_to(&self, output: &mut O) -> Result<(), O::Error>

Implementors§

Source§

impl<O> Writable<O> for NoOp
where O: Output,

Source§

impl<O> Writable<O> for Lifetime<'_>
where O: Output,

Source§

impl<O> Writable<O> for ModPub
where O: Output,

Source§

impl<O> Writable<O> for MustUse
where O: Output,

Source§

impl<O> Writable<O> for NoMangle

Source§

impl<O, Abi> Writable<O> for ModUnsafeExtern<Abi>
where O: Output, Abi: Writable<O>,

Source§

impl<O, Attr, Abi, Body> Writable<O> for ExternBlock<Attr, Abi, Body>
where O: Output, O::Ctx: ContextProvides<Edition>, Attr: WritableSeq<O>, Abi: Writable<O>, Body: Writable<O>,

Source§

impl<O, Attr, Mods, Name, Args, Return, Body> Writable<O> for FunctionDef<Attr, Mods, Name, Args, Return, Body>
where O: Output, Attr: WritableSeq<O>, Mods: WritableSeq<O>, Name: Writable<O>, Args: WritableSeq<O>, Return: Writable<O>, Body: Writable<O>,

Source§

impl<O, Attr, Mods, Name, TypeVars, SuperTraits, Body> Writable<O> for TraitDef<Attr, Mods, Name, TypeVars, SuperTraits, Body>
where O: Output, Attr: WritableSeq<O>, Mods: WritableSeq<O>, Name: Writable<O>, TypeVars: WritableSeq<O>, SuperTraits: WritableSeq<O>, Body: Writable<O>,

Source§

impl<O, Cond, Attr> Writable<O> for CfgAttr<Cond, Attr>
where O: Output, Cond: Writable<O>, Attr: Writable<O>,

Source§

impl<O, InputVars, Expr> Writable<O> for Closure<InputVars, Expr>
where O: Output, InputVars: WritableSeq<O>, Expr: Writable<O>,

Source§

impl<O, Lints> Writable<O> for AllowLints<Lints>
where O: Output, Lints: WritableSeq<O>,

Source§

impl<O, Msg, Since> Writable<O> for Deprecated<Msg, Since>
where O: Output, Msg: Writable<O>, Since: Writable<O>,

Source§

impl<O, Name, Args> Writable<O> for Function<Name, Args>
where O: Output, Name: Writable<O>, Args: WritableSeq<O>,

Source§

impl<O, Name, Type> Writable<O> for FunctionParam<Name, Type>
where O: Output, Name: Writable<O>, Type: Writable<O>,

Source§

impl<O, Name, TypeArgs> Writable<O> for Parameterized<Name, TypeArgs>
where O: Output, Name: Writable<O>, TypeArgs: WritableSeq<O>,

Source§

impl<O, STR> Writable<O> for Str<STR>
where O: Output, STR: AsRef<str>,

Source§

impl<O, TypeVar, Bounds> Writable<O> for BoundedTypeVar<TypeVar, Bounds>
where O: Output, TypeVar: Writable<O>, Bounds: WritableSeq<O>,

Source§

impl<O, TypeVars, Trait, Recv, Body> Writable<O> for TraitImpl<TypeVars, Trait, Recv, Body>
where O: Output, TypeVars: WritableSeq<O>, Trait: Writable<O>, Recv: Writable<O>, Body: Writable<O>,

Source§

impl<O, W1, W2> Writable<O> for Combined<W1, W2>
where O: Output, W1: Writable<O>, W2: Writable<O>,

Source§

impl<O: Output> Writable<O> for FunctionBodyDeclare

Source§

impl<O: Output, Cont, Item> Writable<O> for AssociatedItem<Cont, Item>
where Cont: Writable<O>, Item: Writable<O>,

Source§

impl<O: Output, Expr> Writable<O> for OkResultOf<Expr>
where Expr: Writable<O>,

Source§

impl<O: Output, Expr> Writable<O> for QuestionMarkAfter<Expr>
where Expr: Writable<O>,

Source§

impl<O: Output, Expr> Writable<O> for UnsafeBlock<Expr>
where Expr: Writable<O>,

Source§

impl<O: Output, Recv, FuncName, Args> Writable<O> for FunctionCall<Recv, FuncName, Args>
where Recv: Writable<O>, FuncName: Writable<O>, Args: WritableSeq<O>,

Source§

impl<O: Output, Type> Writable<O> for DynOf<Type>
where Type: Writable<O>,

Source§

impl<O: Output, Type> Writable<O> for ImplOf<Type>
where Type: Writable<O>,

Source§

impl<O: Output, Type> Writable<O> for LifetimedRefOf<'_, Type>
where Type: Writable<O>,

Source§

impl<O: Output, Type> Writable<O> for RefOf<Type>
where Type: Writable<O>,

Source§

impl<O: Output, Type, Trait> Writable<O> for TypeAsTrait<Type, Trait>
where Type: Writable<O>, Trait: Writable<O>,

Source§

impl<O: Output, Type, Value> Writable<O> for AssociatedTypeEquals<Type, Value>
where Type: Writable<O>, Value: Writable<O>,

Source§

impl<O: Output, VarName, Value> Writable<O> for AssociatedTypeDef<VarName, Value>
where VarName: Writable<O>, Value: Writable<O>,

Source§

impl<O: Output, Variable, Expr> Writable<O> for LetStmt<Variable, Expr>
where Variable: Writable<O>, Expr: Writable<O>,