pub trait Operations:
Clone
+ Debug
+ PartialEq
+ Serialize
+ DeserializeOwned {
// Required methods
fn infos() -> Vec<OperationInfo>;
fn new_step<S: Scalar>(kind: &str, before: &Part<S>) -> GeopResult<Self>;
fn apply<S: Scalar>(
&self,
part: Part<S>,
operation_id: &str,
) -> GeopResult<Part<S>>;
fn new_session(&self) -> Box<dyn Any>;
fn form<'a, S: Scalar>(
&self,
before: &'a Part<S>,
session: &dyn Any,
selection: &[String],
) -> Form<'a, S>;
fn set<S: Scalar>(
&mut self,
before: &Part<S>,
session: &mut dyn Any,
selection: &mut Vec<String>,
key: &str,
value: Value,
);
fn event<S: Scalar>(
&mut self,
before: &Part<S>,
session: &mut dyn Any,
selection: &mut Vec<String>,
event: &CanvasEvent<S>,
);
fn kind(&self) -> &'static str;
fn label(&self) -> &'static str;
}Expand description
A set of operations, each together with its arguments: the enum a
crate::Program’s steps hold.
Written by #[derive(Operations)] on an enum whose every variant is
Name(NameArgs), with Name the unit struct implementing Operation
with Args = NameArgs: it dispatches to Name, and converts from each
NameArgs. A variant’s doc comment describes the operation, and
#[operation(label = "...")] gives its short name if that is not the
variant’s. A step’s session is the session of its operation, boxed:
sessions differ by operation.
Required Methods§
Sourcefn infos() -> Vec<OperationInfo>
fn infos() -> Vec<OperationInfo>
Every operation of the set.
Sourcefn new_step<S: Scalar>(kind: &str, before: &Part<S>) -> GeopResult<Self>
fn new_step<S: Scalar>(kind: &str, before: &Part<S>) -> GeopResult<Self>
A new step of the operation kind, inserted after before, see
Operation::new_args.
Sourcefn apply<S: Scalar>(
&self,
part: Part<S>,
operation_id: &str,
) -> GeopResult<Part<S>>
fn apply<S: Scalar>( &self, part: Part<S>, operation_id: &str, ) -> GeopResult<Part<S>>
See Operation::apply.
Sourcefn new_session(&self) -> Box<dyn Any>
fn new_session(&self) -> Box<dyn Any>
A fresh session for editing this step.
Sourcefn form<'a, S: Scalar>(
&self,
before: &'a Part<S>,
session: &dyn Any,
selection: &[String],
) -> Form<'a, S>
fn form<'a, S: Scalar>( &self, before: &'a Part<S>, session: &dyn Any, selection: &[String], ) -> Form<'a, S>
See Operation::form, as an editor reads it; session is one
Operations::new_session made for a step of the same operation.
Sourcefn set<S: Scalar>(
&mut self,
before: &Part<S>,
session: &mut dyn Any,
selection: &mut Vec<String>,
key: &str,
value: Value,
)
fn set<S: Scalar>( &mut self, before: &Part<S>, session: &mut dyn Any, selection: &mut Vec<String>, key: &str, value: Value, )
See Operation::set.
Sourcefn event<S: Scalar>(
&mut self,
before: &Part<S>,
session: &mut dyn Any,
selection: &mut Vec<String>,
event: &CanvasEvent<S>,
)
fn event<S: Scalar>( &mut self, before: &Part<S>, session: &mut dyn Any, selection: &mut Vec<String>, event: &CanvasEvent<S>, )
See Operation::event.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".