pub trait PartOperation: 'static {
type Args: Serialize + DeserializeOwned + Debug + PartialEq + Clone + 'static;
type Session: Clone + Default + 'static;
const KIND: &'static str;
const INFO: OperationInfo;
// Required methods
fn new_args(context: &Context<'_>) -> Self::Args;
fn run(ctx: &mut StepContext<'_>, args: &Self::Args) -> GeopResult<()>;
fn form<'a>(
context: &'a Context<'a>,
args: &Self::Args,
editing: &FormState<Self::Session>,
) -> EditForm<'a, Self::Args, Self::Session>;
// Provided methods
fn begin_event(session: &mut Self::Session) { ... }
fn canvas(
context: &Context<'_>,
edit: Edit<'_, Self::Args, Self::Session>,
event: &CanvasEvent,
) { ... }
}Expand description
One kind of step of a part, and how it is edited.
Required Associated Constants§
const INFO: OperationInfo
Required Associated Types§
Required Methods§
Sourcefn new_args(context: &Context<'_>) -> Self::Args
fn new_args(context: &Context<'_>) -> Self::Args
The arguments of a new step: sensible defaults, taking the part it is inserted into into account.
Sourcefn run(ctx: &mut StepContext<'_>, args: &Self::Args) -> GeopResult<()>
fn run(ctx: &mut StepContext<'_>, args: &Self::Args) -> GeopResult<()>
Declares what the step produces, through ctx (see
StepContext::produce).
Sourcefn form<'a>(
context: &'a Context<'a>,
args: &Self::Args,
editing: &FormState<Self::Session>,
) -> EditForm<'a, Self::Args, Self::Session>
fn form<'a>( context: &'a Context<'a>, args: &Self::Args, editing: &FormState<Self::Session>, ) -> EditForm<'a, Self::Args, Self::Session>
What the editor shows while the step is edited, with what setting each field does. Never fails: an editor needs the form most exactly when the arguments do not build, so whatever is wrong is said in it.
Provided Methods§
Sourcefn begin_event(session: &mut Self::Session)
fn begin_event(session: &mut Self::Session)
What the session forgets at the start of every event, before the event is handled: nothing, by default.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".