[][src]Struct sval::stream::OwnedStream

pub struct OwnedStream<S>(_);

An owned stream wrapper.

OwnedStream is an ergonomic wrapper over a raw Stream that makes it easier to stream complex types.

Implementations

impl<S> OwnedStream<S> where
    S: Stream
[src]

pub fn stream(stream: S, value: impl Value) -> Result<S, Error>[src]

Stream a value.

pub fn new(stream: S) -> Self[src]

Begin an owned stream.

pub fn into_inner(self) -> S[src]

Unwrap the inner stream.

pub fn borrow_mut(&mut self) -> RefMutStream<'_>[src]

Get a reference to the stream that can be used by a value.

pub fn any(&mut self, v: impl Value) -> Result[src]

Stream a value.

pub fn debug(&mut self, v: impl Debug) -> Result[src]

Stream a debuggable type.

pub fn display(&mut self, v: impl Display) -> Result[src]

Stream a displayable type.

pub fn error(&mut self, v: &(dyn Error + 'static)) -> Result[src]

Stream an error.

This method is only available when the std feature is enabled.

Examples

Errors that don't satisfy the trait bounds needed by this method can go through Source:

impl Value for MyError {
    fn stream(&self, stream: &mut value::Stream) -> value::Result {
        use sval::stream::Source;

        stream.any(Source::new(&self.error))
    }
}

pub fn i64(&mut self, v: i64) -> Result[src]

Stream a signed integer.

pub fn u64(&mut self, v: u64) -> Result[src]

Stream an unsigned integer.

pub fn i128(&mut self, v: i128) -> Result[src]

Stream a 128-bit signed integer.

pub fn u128(&mut self, v: u128) -> Result[src]

Stream a 128-bit unsigned integer.

pub fn f64(&mut self, v: f64) -> Result[src]

Stream a floating point value.

pub fn bool(&mut self, v: bool) -> Result[src]

Stream a boolean.

pub fn char(&mut self, v: char) -> Result[src]

Stream a unicode character.

pub fn str(&mut self, v: &str) -> Result[src]

Stream a UTF8 string.

pub fn none(&mut self) -> Result[src]

Stream an empty value.

pub fn map_begin(&mut self, len: Option<usize>) -> Result[src]

Begin a map.

pub fn map_key(&mut self, k: impl Value) -> Result[src]

Stream a map key.

pub fn map_value(&mut self, v: impl Value) -> Result[src]

Stream a map value.

pub fn map_end(&mut self) -> Result[src]

End a map.

pub fn seq_begin(&mut self, len: Option<usize>) -> Result[src]

Begin a sequence.

pub fn seq_elem(&mut self, v: impl Value) -> Result[src]

Stream a sequence element.

pub fn seq_end(&mut self) -> Result[src]

End a sequence.

impl<S> OwnedStream<S> where
    S: Stream
[src]

pub fn map_key_begin(&mut self) -> Result<&mut Self, Error>[src]

Begin a map key.

pub fn map_value_begin(&mut self) -> Result<&mut Self, Error>[src]

Begin a map value.

pub fn seq_elem_begin(&mut self) -> Result<&mut Self, Error>[src]

Begin a sequence element.

Trait Implementations

impl<S> Stream for OwnedStream<S> where
    S: Stream
[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for OwnedStream<S> where
    S: RefUnwindSafe
[src]

impl<S> Send for OwnedStream<S> where
    S: Send
[src]

impl<S> Sync for OwnedStream<S> where
    S: Sync
[src]

impl<S> Unpin for OwnedStream<S> where
    S: Unpin
[src]

impl<S> UnwindSafe for OwnedStream<S> where
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.