Skip to main content

FileSystemEmbedded

Struct FileSystemEmbedded 

Source
pub struct FileSystemEmbedded { /* private fields */ }
Expand description

Module resolution and loading functionality. File system implementation that uses embedded modules compiled into the binary.

This implementation stores all module contents in a compile-time perfect hash map, eliminating any runtime file system access. This is the basic secure option for module loading as it provides a completely closed set of available modules without filesystem access.

§Example

use hyperlight_js::embed_modules;

let fs = embed_modules! {
    "math.js" => "../tests/fixtures/math.js",
    "strings.js" => "../tests/fixtures/strings.js",
};

Implementations§

Source§

impl FileSystemEmbedded

Source

pub const fn new(modules: &'static Map<&'static str, &'static str>) -> Self

Create a new embedded file system with the given module map.

See the embed_modules! macro for an easier way to create

Trait Implementations§

Source§

impl Clone for FileSystemEmbedded

Source§

fn clone(&self) -> FileSystemEmbedded

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl FileSystem for FileSystemEmbedded

Source§

fn new() -> Self

Source§

fn read(&self, path: &Path) -> Result<Vec<u8>>

Source§

fn read_to_string(&self, path: &Path) -> Result<String>

Source§

fn metadata(&self, path: &Path) -> Result<FileMetadata>

Returns the resolution of a symbolic link. Read more
Source§

fn canonicalize(&self, path: &Path) -> Result<PathBuf>

Returns the canonical, absolute form of a path with all intermediate components normalized. Read more
Source§

impl Copy for FileSystemEmbedded

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more