Skip to main content

StudioFiles

Struct StudioFiles 

Source
pub struct StudioFiles<S> { /* private fields */ }
Expand description

The Studio’s files: the shipped examples over the reader’s store.

Implementations§

Source§

impl<S> StudioFiles<S>

Source

pub fn new(store: S) -> Self

Source

pub fn store(&self) -> &S

The reader’s store underneath.

Source§

impl<S: Vfs> StudioFiles<S>

Source

pub async fn retire_old_copies(&self) -> VfsResult<usize>

Remove the copies of the examples an earlier Studio wrote into the reader’s store, every file and folder under /examples, and count what went. They have not shown since the examples came from the site, and nothing else writes there, since the reader’s files live in /workspace. A store with no such folder costs one listing. A removal cut short finishes on the next visit.

Trait Implementations§

Source§

impl<S: Clone> Clone for StudioFiles<S>

Source§

fn clone(&self) -> StudioFiles<S>

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<S: Vfs> Vfs for StudioFiles<S>

Source§

fn read<'a, 'b, 'f>( &'a self, path: &'b str, ) -> Pin<Box<dyn Future<Output = VfsResult<Vec<u8>>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f,

Read entire file contents as bytes.
Source§

fn read_to_string<'a, 'b, 'f>( &'a self, path: &'b str, ) -> Pin<Box<dyn Future<Output = VfsResult<String>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f,

Read file contents as UTF-8 string.
Source§

fn write<'a, 'b, 'c, 'f>( &'a self, path: &'b str, contents: &'c [u8], ) -> Pin<Box<dyn Future<Output = VfsResult<()>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f, 'c: 'f,

Write bytes to file (atomic on native, best-effort on WASM).
Source§

fn append<'a, 'b, 'c, 'f>( &'a self, path: &'b str, contents: &'c [u8], ) -> Pin<Box<dyn Future<Output = VfsResult<()>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f, 'c: 'f,

Append bytes to file (atomic append semantics).
Source§

fn exists<'a, 'b, 'f>( &'a self, path: &'b str, ) -> Pin<Box<dyn Future<Output = VfsResult<bool>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f,

Check if file exists.
Source§

fn remove<'a, 'b, 'f>( &'a self, path: &'b str, ) -> Pin<Box<dyn Future<Output = VfsResult<()>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f,

Delete a file.
Source§

fn create_dir_all<'a, 'b, 'f>( &'a self, path: &'b str, ) -> Pin<Box<dyn Future<Output = VfsResult<()>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f,

Create directory and all parent directories.
Source§

fn rename<'a, 'b, 'c, 'f>( &'a self, from: &'b str, to: &'c str, ) -> Pin<Box<dyn Future<Output = VfsResult<()>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f, 'c: 'f,

Atomically rename a file (for journal compaction).
Source§

fn list_dir<'a, 'b, 'f>( &'a self, path: &'b str, ) -> Pin<Box<dyn Future<Output = VfsResult<Vec<DirEntry>>> + Send + 'f>>
where Self: 'f, 'a: 'f, 'b: 'f,

List entries in a directory.

Auto Trait Implementations§

§

impl<S> Freeze for StudioFiles<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for StudioFiles<S>
where S: RefUnwindSafe,

§

impl<S> Send for StudioFiles<S>
where S: Send,

§

impl<S> Sync for StudioFiles<S>
where S: Sync,

§

impl<S> Unpin for StudioFiles<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for StudioFiles<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for StudioFiles<S>
where S: UnwindSafe,

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InitializeFromFunction<T> for T

§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
§

impl<T> Instrument for T

§

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

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

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> Same for T

Source§

type Output = T

Should always be Self
§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

§

fn super_from(input: T) -> O

Convert from a type to another type.
§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

§

fn super_into(self) -> O

Convert from a type to another type.
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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,