pub struct FileBuf { /* private fields */ }Expand description
Like [File] but owns the buffer.
Returned by load_file_buf. Requires a global allocator.
For a file of statically-known size, you might want to use load_file instead.
Implementations§
Source§impl FileBuf
impl FileBuf
Sourcepub unsafe fn from_bytes(b: Box<[u8]>) -> Self
pub unsafe fn from_bytes(b: Box<[u8]>) -> Self
Construct FileBuf from raw bytes.
The main purpose of this function is to support convering FileBuf
to and from “basic” types, which might be required for implementing
some language interpreters (Lua, Python, etc) for Firefly in Rust.
§Safety
This function allows bypassing type safety and constructing Image
and Font in runtime. Don’t do that. Relying on internal representation
of file formats might make your app incompatible with future Firefly runtimes.
If you need to modify an in-memory image, use Canvas instead.
pub fn into_font(self) -> FontBuf
pub fn into_image(self) -> ImageBuf
pub fn into_bytes(self) -> Box<[u8]>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileBuf
impl RefUnwindSafe for FileBuf
impl Send for FileBuf
impl Sync for FileBuf
impl Unpin for FileBuf
impl UnsafeUnpin for FileBuf
impl UnwindSafe for FileBuf
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more