Trait ItemArgument

Source
pub(crate) trait ItemArgument {
    // Required method
    fn write_onto(&self, out: &mut ItemEncoder<'_>) -> Result<(), Bug>;
}
Available on crate feature hs-service only.
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_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.

Implementations on Foreign Types§

Source§

impl ItemArgument for i8

Source§

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

Source§

impl ItemArgument for i16

Source§

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

Source§

impl ItemArgument for i32

Source§

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

Source§

impl ItemArgument for i64

Source§

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

Source§

impl ItemArgument for i128

Source§

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

Source§

impl ItemArgument for isize

Source§

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

Source§

impl ItemArgument for str

Source§

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

Source§

impl ItemArgument for u8

Source§

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

Source§

impl ItemArgument for u16

Source§

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

Source§

impl ItemArgument for u32

Source§

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

Source§

impl ItemArgument for u64

Source§

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

Source§

impl ItemArgument for u128

Source§

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

Source§

impl ItemArgument for usize

Source§

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

Source§

impl ItemArgument for String

Source§

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

Source§

impl ItemArgument for Effort

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

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

Source§

impl ItemArgument for Seed

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

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

Source§

impl<T: ItemArgument + ?Sized> ItemArgument for &T

Source§

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

Implementors§