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§
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§
Sourcefn write<W>(
&self,
w: &mut W,
object: &Self::Object,
store: Option<&Self::Cache>,
) -> Result<(), Error>where
W: Write,
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
.
Sourcefn write_to_string(
&self,
object: &Self::Object,
store: Option<&Self::Cache>,
) -> Result<String, Error>
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.
fn write_to_string_with( &self, object: &Self::Object, store: Option<&Self::Cache>, options: &Self::Options, ) -> Result<String, Error>
Sourcefn write_to_file<P>(
&self,
object: &Self::Object,
store: Option<&Self::Cache>,
path: P,
) -> Result<(), Error>
fn write_to_file<P>( &self, object: &Self::Object, store: Option<&Self::Cache>, path: P, ) -> Result<(), Error>
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.
fn write_to_file_with<P>( &self, object: &Self::Object, store: Option<&Self::Cache>, path: P, options: &Self::Options, ) -> Result<(), Error>
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.