pub struct StudioOpening {
pub path: String,
pub mode: StudioMode,
pub text: Option<&'static str>,
}Expand description
The file the Studio opens with, the mode it opens in, and its text when the site carries it.
Fields§
§path: StringThe file’s VFS path, with its leading slash.
mode: StudioModeThe mode the file opens in.
text: Option<&'static str>The file’s text when the site carries it, as it does every shipped example. A reader’s own file has none until the file system reads it.
Implementations§
Source§impl StudioOpening
impl StudioOpening
Sourcepub fn for_route(file: Option<&str>) -> Self
pub fn for_route(file: Option<&str>) -> Self
What the Studio opens on for the route’s file, a VFS path with or without its leading
slash: a shipped example in its own mode with its text; a reader’s file in the mode its path
names, its text left to the file system; and with no file, the first example.
Sourcepub fn first_example() -> Self
pub fn first_example() -> Self
A bare /studio: the first Code example, in the order the file browser shows the examples.
Sourcepub fn editor_text(&self, mode: StudioMode) -> String
pub fn editor_text(&self, mode: StudioMode) -> String
The text mode’s editor starts with: the opening’s text in its own mode’s editor — Code and
Web share one — and nothing in the others.
Sourcepub fn current_file(&self) -> Option<String>
pub fn current_file(&self) -> Option<String>
The file the Studio shows open from its first frame: the opening’s, when the site carries its text. A reader’s own file is open only once the file system has read it.
Sourcepub fn arrival(
&self,
open: Option<&str>,
editor: &str,
read: Option<String>,
) -> Arrival
pub fn arrival( &self, open: Option<&str>, editor: &str, read: Option<String>, ) -> Arrival
What the file system’s answer changes: open is the file open now, editor what the
opening’s editor holds, and read the file’s text, None when the file system has no such
file.
What the reader does is theirs: once they have opened another file, or the editor holds anything but what the Studio opened with, nothing replaces it. Otherwise a reader’s file opens with its text, an example whose stored copy differs opens with that copy, and a file nobody has falls back to the first example. An example already on screen stays as it is, stored or not.
Trait Implementations§
Source§impl Clone for StudioOpening
impl Clone for StudioOpening
Source§fn clone(&self) -> StudioOpening
fn clone(&self) -> StudioOpening
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StudioOpening
impl Debug for StudioOpening
Source§impl PartialEq for StudioOpening
impl PartialEq for StudioOpening
impl Eq for StudioOpening
impl StructuralPartialEq for StudioOpening
Auto Trait Implementations§
impl Freeze for StudioOpening
impl RefUnwindSafe for StudioOpening
impl Send for StudioOpening
impl Sync for StudioOpening
impl Unpin for StudioOpening
impl UnsafeUnpin for StudioOpening
impl UnwindSafe for StudioOpening
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.