Skip to main content

ItemArgument

Trait ItemArgument 

Source
pub trait ItemArgument {
    // Required method
    fn write_arg_onto(&self, out: &mut ItemEncoder<'_>) -> Result<(), Bug>;
}
Expand description

Types that can be added as argument(s) to item keyword lines

Implemented for strings, and various other types.

This is a separate trait so we can control the formatting of (eg) Iso8601TimeSp, without having a method on ItemEncoder for each argument type.

Required Methods§

Source

fn write_arg_onto(&self, out: &mut ItemEncoder<'_>) -> Result<(), Bug>

Format as a string suitable for including as a netdoc keyword line argument

The implementation is responsible for checking that the syntax is legal. For example, if self is a string, it must check that the string is in legal as a single argument.

Some netdoc values (eg times) turn into several arguments; in that case, one ItemArgument may format into multiple arguments, and this method is responsible for writing them all, with the necessary spaces.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ItemArgument for &str

Source§

fn write_arg_onto(&self, out: &mut ItemEncoder<'_>) -> Result<(), Bug>

Source§

impl ItemArgument for Effort

Available on crate feature hs-pow-full only.
Source§

fn write_arg_onto(&self, out: &mut ItemEncoder<'_>) -> Result<(), Bug>

Source§

impl ItemArgument for Seed

Available on crate feature hs-pow-full only.
Source§

fn write_arg_onto(&self, out: &mut ItemEncoder<'_>) -> Result<(), Bug>

Source§

impl ItemArgument for Signature

Source§

fn write_arg_onto(&self, out: &mut ItemEncoder<'_>) -> StdResult<(), Bug>

Source§

impl ItemArgument for str

Source§

fn write_arg_onto(&self, out: &mut ItemEncoder<'_>) -> Result<(), Bug>

Source§

impl<T: ItemArgument> ItemArgument for Arc<T>

Source§

fn write_arg_onto(&self, out: &mut ItemEncoder<'_>) -> Result<(), Bug>

Implementors§