[][src]Struct olin::Resource

pub struct Resource(_);

Resources are maybe readable, maybe writable, maybe flushable and closable streams of bytes. A resource is backed by implementation in the containing runtime based on the URL scheme used in the open call.

Resources do not always have to be backed by things that exist. Resources may contain the transient results of API calls. Once the data in a Resource has been read, that may be the only time that data can ever be read.

Please take this into consideration when consuming the results of Resources.

The implementation of this type uses the functions at https://github.com/CommonWA/cwa-spec/blob/master/ns/resource.md

Implementations

impl Resource[src]

pub fn open(url: &str) -> Result<Resource, Error>[src]

pub unsafe fn from_raw(handle: i32) -> Resource

Important traits for Resource

impl Read for Resourceimpl Write for Resource
[src]

For the few times you actually do know the file descriptor.

The CommonWA spec doesn't mandate any properties about file descriptors. The implementation in Olin uses random file descriptors, meaning that unless the stdio module is used, this function should probably never be called unless you really know what you are doing.

Passing an invalid file descriptor to this function will result in a handle that returns errors on every call to it. This behavior may be useful.

Trait Implementations

impl Debug for Resource[src]

impl Drop for Resource[src]

impl Read for Resource[src]

impl Write for Resource[src]

Auto Trait Implementations

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<R> ReadBytesExt for R where
    R: Read + ?Sized

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.

impl<W> WriteBytesExt for W where
    W: Write + ?Sized