Trait kernel::schemes::Resource [] [src]

pub trait Resource {
    fn url(&self) -> URL;

    fn dup(&self) -> Option<Box<Resource>> { ... }
    fn read(&mut self, buf: &mut [u8]) -> Option<usize> { ... }
    fn write(&mut self, buf: &[u8]) -> Option<usize> { ... }
    fn seek(&mut self, pos: ResourceSeek) -> Option<usize> { ... }
    fn sync(&mut self) -> bool { ... }
    fn truncate(&mut self, len: usize) -> bool { ... }
    fn read_to_end(&mut self, vec: &mut Vec<u8>) -> Option<usize> { ... }
}

A system resource

Required Methods

fn url(&self) -> URL

Return the url of this resource

Provided Methods

fn dup(&self) -> Option<Box<Resource>>

Duplicate the resource

fn read(&mut self, buf: &mut [u8]) -> Option<usize>

Read data to buffer

fn write(&mut self, buf: &[u8]) -> Option<usize>

Write to resource

fn seek(&mut self, pos: ResourceSeek) -> Option<usize>

Seek

fn sync(&mut self) -> bool

Sync the resource

fn truncate(&mut self, len: usize) -> bool

fn read_to_end(&mut self, vec: &mut Vec<u8>) -> Option<usize>

Implementors