Builder

Struct Builder 

Source
pub struct Builder { /* private fields */ }
Expand description

A builder to write a spectrum.

Implementations§

Source§

impl Builder

Source

pub fn set_format(self, format: Format) -> Self

Set format to write.

If unset, the plain text format will be used.

Source

pub fn set_precision(self, precision: usize) -> Self

Set precision.

This is only used for the plain text format. If unset, a precision of six digits will be used.

Source

pub fn write<W, S: State>( self, writer: &mut W, spectrum: &Spectrum<S>, ) -> Result<()>
where W: Write,

Write spectrum to writer.

Source

pub fn write_to_stdout<S: State>(self, spectrum: &Spectrum<S>) -> Result<()>

Write spectrum to stdout.

Source

pub fn write_to_path<P, S: State>( self, path: P, spectrum: &Spectrum<S>, ) -> Result<()>
where P: AsRef<Path>,

Write spectrum to path.

If path already exists, it will be overwritten.

Source

pub fn write_to_path_or_stdout<P, S: State>( self, path: Option<P>, spectrum: &Spectrum<S>, ) -> Result<()>
where P: AsRef<Path>,

Write spectrum to path or stdout.

If the provided path is None, read from stdin. If path already exists, it will be overwritten.

Trait Implementations§

Source§

impl Debug for Builder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Builder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.