pub struct ScriptsWorkspace { /* private fields */ }Expand description
The Scripts workspace.
Implementations§
Source§impl ScriptsWorkspace
impl ScriptsWorkspace
Sourcepub fn new(
dir: impl Into<PathBuf>,
port_types: Vec<String>,
context: impl Fn(&App) -> Value + 'static,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Self
pub fn new( dir: impl Into<PathBuf>, port_types: Vec<String>, context: impl Fn(&App) -> Value + 'static, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
The scripts in dir (created when missing); port_types are the types a node may use,
context what a script sees as shown.
Sourcepub fn set_runner(&mut self, runner: Runner)
pub fn set_runner(&mut self, runner: Runner)
Runs scripts with runner instead of the default.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Whether a script runs now.
Sourcepub fn select(
&mut self,
i: usize,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn select( &mut self, i: usize, window: &mut Window, cx: &mut Context<'_, Self>, )
Opens script i in the editor.
Sourcepub fn save(&mut self, cx: &mut Context<'_, Self>) -> Result<(), String>
pub fn save(&mut self, cx: &mut Context<'_, Self>) -> Result<(), String>
Writes the editor’s text to the selected script, and reads its header again.
Sourcepub fn new_script(
&mut self,
language: CodeLanguage,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Result<PathBuf, String>
pub fn new_script( &mut self, language: CodeLanguage, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<PathBuf, String>
A new script in language, from a template, opened.
Sourcepub fn run_selected(
&mut self,
args: Value,
cx: &mut Context<'_, Self>,
) -> Result<(), String>
pub fn run_selected( &mut self, args: Value, cx: &mut Context<'_, Self>, ) -> Result<(), String>
Runs the selected script (saved first) with args, off the UI thread, as a job.
Sourcepub fn run(
&mut self,
script: Script,
args: Value,
cx: &mut Context<'_, Self>,
) -> Result<(), String>
pub fn run( &mut self, script: Script, args: Value, cx: &mut Context<'_, Self>, ) -> Result<(), String>
Runs script with args, off the UI thread, as a job; the output shows in the run panel.
Sourcepub fn nodes(&self) -> (Vec<NodeSpec>, Vec<String>)
pub fn nodes(&self) -> (Vec<NodeSpec>, Vec<String>)
The scripts that are pipeline nodes, checked against the app’s port types (a node naming another type is left out, with the reason in the second list).
Sourcepub fn register(&mut self, registry: &Registry, me: WeakEntity<Self>)
pub fn register(&mut self, registry: &Registry, me: WeakEntity<Self>)
Registers each command script in registry (its arguments the schema its header gives;
running it starts it as a job and answers at once), replacing the ones registered before.
Trait Implementations§
impl EventEmitter<ScriptsEvent> for ScriptsWorkspace
Source§impl Render for ScriptsWorkspace
impl Render for ScriptsWorkspace
Auto Trait Implementations§
impl !RefUnwindSafe for ScriptsWorkspace
impl !Send for ScriptsWorkspace
impl !Sync for ScriptsWorkspace
impl !UnwindSafe for ScriptsWorkspace
impl Forget for ScriptsWorkspace
impl Freeze for ScriptsWorkspace
impl Move for ScriptsWorkspace
impl Unpin for ScriptsWorkspace
impl UnsafeUnpin for ScriptsWorkspace
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more