Trait RepresentationWriter

Source
pub trait RepresentationWriter {
    type Object;
    type Cache: ModuleStore;
    type Options: Default;

    // Required method
    fn write_with<W>(
        &self,
        w: &mut W,
        object: &Self::Object,
        store: Option<&Self::Cache>,
        options: &Self::Options,
    ) -> Result<(), Error>
       where W: Write;

    // Provided methods
    fn write<W>(
        &self,
        w: &mut W,
        object: &Self::Object,
        store: Option<&Self::Cache>,
    ) -> Result<(), Error>
       where W: Write { ... }
    fn write_to_string(
        &self,
        object: &Self::Object,
        store: Option<&Self::Cache>,
    ) -> Result<String, Error> { ... }
    fn write_to_string_with(
        &self,
        object: &Self::Object,
        store: Option<&Self::Cache>,
        options: &Self::Options,
    ) -> Result<String, Error> { ... }
    fn write_to_file<P>(
        &self,
        object: &Self::Object,
        store: Option<&Self::Cache>,
        path: P,
    ) -> Result<(), Error>
       where P: AsRef<Path> { ... }
    fn write_to_file_with<P>(
        &self,
        object: &Self::Object,
        store: Option<&Self::Cache>,
        path: P,
        options: &Self::Options,
    ) -> Result<(), Error>
       where P: AsRef<Path> { ... }
}
Expand description

The trait implemented by types which write instances of T.

Required Associated Types§

Required Methods§

Source

fn write_with<W>( &self, w: &mut W, object: &Self::Object, store: Option<&Self::Cache>, options: &Self::Options, ) -> Result<(), Error>
where W: Write,

Provided Methods§

Source

fn write<W>( &self, w: &mut W, object: &Self::Object, store: Option<&Self::Cache>, ) -> Result<(), Error>
where W: Write,

Write an instance of T to the provided implementation of Write.

Source

fn write_to_string( &self, object: &Self::Object, store: Option<&Self::Cache>, ) -> Result<String, Error>

Write an instance of T to, and return, a string.

Source

fn write_to_string_with( &self, object: &Self::Object, store: Option<&Self::Cache>, options: &Self::Options, ) -> Result<String, Error>

Source

fn write_to_file<P>( &self, object: &Self::Object, store: Option<&Self::Cache>, path: P, ) -> Result<(), Error>
where P: AsRef<Path>,

Write an instance of T into the file identified by path.

This method will return an IO error if the path is invalid, or the file is not writeable. If the file exists it will be replaced.

Source

fn write_to_file_with<P>( &self, object: &Self::Object, store: Option<&Self::Cache>, path: P, options: &Self::Options, ) -> Result<(), Error>
where P: AsRef<Path>,

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.

Implementors§