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 ModUnsafe
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, Abi, Body> Writable<O> for ExternBlock<Abi, Body>
where O: Output, O::Ctx: ContextProvides<Edition>, Abi: Writable<O>, Body: Writable<O>,

Source§

impl<O, Arg> Writable<O> for Link<Arg>
where O: Output, Arg: Writable<O>,

Source§

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

Source§

impl<O, Args, Return> Writable<O> for FunctionPtr<Args, Return>
where O: Output, Args: WritableSeq<O>, Return: Writable<O>,

Source§

impl<O, Attr, Value> Writable<O> for WithAttributes<Attr, Value>
where O: Output, Attr: WritableSeq<O>, Value: Writable<O>,

Source§

impl<O, Before, After> Writable<O> for Else<Before, After>
where O: Output, Before: Writable<O>, After: Writable<O>,

Source§

impl<O, Body> Writable<O> for Block<Body>
where O: Output, Body: Writable<O>,

Source§

impl<O, Cond> Writable<O> for Cfg<Cond>
where O: Output, Cond: 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, Cond, Body> Writable<O> for IfBlock<Cond, Body>
where O: Output, Cond: Writable<O>, Body: Writable<O>,

Source§

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

Source§

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

Source§

impl<O, Fields> Writable<O> for StructFields<Fields>
where O: Output, Fields: WritableSeq<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, Mods, Name, Args, Return, Where, Body> Writable<O> for FunctionDef<Mods, Name, Args, Return, Where, Body>
where O: Output, Mods: WritableSeq<O>, Name: Writable<O>, Args: WritableSeq<O>, Return: Writable<O>, Where: WritableSeq<O>, Body: Writable<O>,

Source§

impl<O, Mods, Name, Elements> Writable<O> for StructDef<Mods, Name, Elements>
where O: Output, Mods: WritableSeq<O>, Name: Writable<O>, Elements: WritableSeq<O>,

Source§

impl<O, Mods, Name, Entries> Writable<O> for EnumDef<Mods, Name, Entries>
where O: Output, Mods: WritableSeq<O>, Name: Writable<O>, Entries: WritableSeq<O>,

Source§

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

Source§

impl<O, Mods, TypeVars, Trait, Recv, Where, Body> Writable<O> for TraitImpl<Mods, TypeVars, Trait, Recv, Where, Body>
where O: Output, Mods: WritableSeq<O>, TypeVars: WritableSeq<O>, Trait: Writable<O>, Recv: Writable<O>, Where: WritableSeq<O>, Body: Writable<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 NamedTuple<Name, Args>
where O: Output, Name: Writable<O>, Args: WritableSeq<O>,

Source§

impl<O, Name, Body> Writable<O> for ModBlock<Name, Body>
where O: Output, Name: Writable<O>, Body: Writable<O>,

Source§

impl<O, Name, Body> Writable<O> for StructCall<Name, Body>
where O: Output, Name: Writable<O>, Body: Writable<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, Name, Value> Writable<O> for DeclareField<Name, Value>
where O: Output, Name: Writable<O>, Value: Writable<O>,

Source§

impl<O, Pattern, Expr> Writable<O> for LetExpr<Pattern, Expr>
where O: Output, Pattern: Writable<O>, Expr: Writable<O>,

Source§

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

Source§

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

Source§

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

Source§

impl<O, Value> Writable<O> for Target<Value>
where O: Output, Value: 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, W> Writable<O> for BoxedIndirection<W>
where O: Output, W: 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, Elements> Writable<O> for ArrayFromElements<Elements>
where Elements: WritableSeq<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, Inner> Writable<O> for FunctionBodyImplement<Inner>
where Inner: Writable<O>,

Source§

impl<O: Output, Name, Args> Writable<O> for Turbofish<Name, Args>
where Name: Writable<O>, Args: WritableSeq<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 AssignStmt<Variable, Expr>
where Variable: Writable<O>, Expr: Writable<O>,

Source§

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