pub struct EventDef<F: IntegrateFloat> {
pub name: String,
pub direction: CrossingDirection,
pub response: EventResponse,
pub root_method: RootFindingMethod,
pub tolerance: F,
pub max_root_iter: usize,
pub max_count: Option<usize>,
/* private fields */
}Expand description
Configuration for a single event.
Fields§
§name: StringUnique name for this event
direction: CrossingDirectionDirection of zero-crossing to detect
response: EventResponseAction when event is detected
root_method: RootFindingMethodRoot-finding method for precise location
tolerance: FTolerance for root finding
max_root_iter: usizeMaximum iterations for root finding
max_count: Option<usize>Maximum number of times this event can fire (None = unlimited)
Implementations§
Source§impl<F: IntegrateFloat> EventDef<F>
impl<F: IntegrateFloat> EventDef<F>
Sourcepub fn new<G>(name: &str, event_fn: G) -> Self
pub fn new<G>(name: &str, event_fn: G) -> Self
Create a new event definition with a name and event function.
Sourcepub fn with_direction(self, dir: CrossingDirection) -> Self
pub fn with_direction(self, dir: CrossingDirection) -> Self
Set the crossing direction.
Sourcepub fn with_response(self, resp: EventResponse) -> Self
pub fn with_response(self, resp: EventResponse) -> Self
Set the event response.
Sourcepub fn with_root_method(self, method: RootFindingMethod) -> Self
pub fn with_root_method(self, method: RootFindingMethod) -> Self
Set the root-finding method.
Sourcepub fn with_max_count(self, count: usize) -> Self
pub fn with_max_count(self, count: usize) -> Self
Set maximum fire count.
Sourcepub fn with_tolerance(self, tol: F) -> Self
pub fn with_tolerance(self, tol: F) -> Self
Set root-finding tolerance.
Auto Trait Implementations§
impl<F> Freeze for EventDef<F>where
F: Freeze,
impl<F> !RefUnwindSafe for EventDef<F>
impl<F> Send for EventDef<F>where
F: Send,
impl<F> Sync for EventDef<F>where
F: Sync,
impl<F> Unpin for EventDef<F>where
F: Unpin,
impl<F> UnsafeUnpin for EventDef<F>where
F: UnsafeUnpin,
impl<F> !UnwindSafe for EventDef<F>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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