Struct dbsdk_rs::io::FileStream
source · [−]pub struct FileStream { /* private fields */ }
Implementations
sourceimpl FileStream
impl FileStream
sourcepub fn open(path: &String, mode: FileMode) -> Result<FileStream, IOError>
pub fn open(path: &String, mode: FileMode) -> Result<FileStream, IOError>
Open a file from the filesystem (paths are given in the form of “/[device]/path/to/file”)
Valid devices are “cd”, “ma”, and “mb”
sourcepub fn allocate_memory_card(
path: &String,
icondata: &[u8; 128],
iconpalette: &[u16; 16],
blocks: i32
) -> Result<FileStream, IOError>
pub fn allocate_memory_card(
path: &String,
icondata: &[u8; 128],
iconpalette: &[u16; 16],
blocks: i32
) -> Result<FileStream, IOError>
Allocate a new file on the memory card device given in the path string of the given size in 512-byte blocks for writing
sourcepub fn read_to_string(&self, buffer: &mut String) -> Result<usize, IOError>
pub fn read_to_string(&self, buffer: &mut String) -> Result<usize, IOError>
Read file until EOF into the given string buffer
sourcepub fn read(&self, buffer: &mut [u8]) -> Result<usize, IOError>
pub fn read(&self, buffer: &mut [u8]) -> Result<usize, IOError>
Try to read a number of bytes from the stream, returning the actual number of bytes read
sourcepub fn read_element<T: Copy>(&self) -> Result<T, IOError>
pub fn read_element<T: Copy>(&self) -> Result<T, IOError>
Read an element from the stream, returning an error if there aren’t enough bytes in the stream or some other error occurs
sourcepub fn write(&self, buffer: &[u8]) -> Result<i32, IOError>
pub fn write(&self, buffer: &[u8]) -> Result<i32, IOError>
Try to write a buffer of bytes to the stream, returning the actual number of bytes written
sourcepub fn seek(&self, position: i32, origin: SeekOrigin) -> Result<i32, IOError>
pub fn seek(&self, position: i32, origin: SeekOrigin) -> Result<i32, IOError>
Try to seek the stream to the given position, returning the new position
sourcepub fn end_of_file(&self) -> bool
pub fn end_of_file(&self) -> bool
Gets whether the stream has reached its end
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for FileStream
impl Send for FileStream
impl Sync for FileStream
impl Unpin for FileStream
impl UnwindSafe for FileStream
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more