Enum fj_kernel::partial::MaybePartial
source · [−]pub enum MaybePartial<T: HasPartial> {
Full(T),
Partial(T::Partial),
}Expand description
Can be used everywhere either a partial or full objects are accepted
Some convenience methods are available for specific instances of
MaybePartial (like, MaybePartial<Curve>, or MaybePartial<Vertex>).
Implementation Note
The set of available convenience methods is far from complete. Please feel free to just add more, if you need them.
Variants
Full(T)
A full object
Partial(T::Partial)
A partial object
Implementations
sourceimpl<T: HasPartial> MaybePartial<T>
impl<T: HasPartial> MaybePartial<T>
sourcepub fn update_partial(self, f: impl FnOnce(T::Partial) -> T::Partial) -> Self
pub fn update_partial(self, f: impl FnOnce(T::Partial) -> T::Partial) -> Self
If this is a partial object, update it
This is useful whenever a partial object can infer something about its parts from other parts, and wants to update what was inferred, in case it can be updated.
sourcepub fn into_full(self, stores: &Stores) -> T
pub fn into_full(self, stores: &Stores) -> T
Return or build a full object
If this already is a full object, it is returned. If this is a partial
object, the full object is built from it, using Partial::build.
sourcepub fn into_partial(self) -> T::Partial
pub fn into_partial(self) -> T::Partial
Return or convert a partial object
If this already is a partial object, is is returned. If this is a full
object, it is converted into a partial object using
HasPartial::to_partial.
sourceimpl MaybePartial<Curve>
impl MaybePartial<Curve>
sourcepub fn global_form(&self) -> Option<Handle<GlobalCurve>>
pub fn global_form(&self) -> Option<Handle<GlobalCurve>>
Access the global form
sourceimpl MaybePartial<GlobalEdge>
impl MaybePartial<GlobalEdge>
sourcepub fn curve(&self) -> Option<&Handle<GlobalCurve>>
pub fn curve(&self) -> Option<&Handle<GlobalCurve>>
Access the curve
sourceimpl MaybePartial<Vertex>
impl MaybePartial<Vertex>
sourcepub fn surface_form(&self) -> Option<MaybePartial<SurfaceVertex>>
pub fn surface_form(&self) -> Option<MaybePartial<SurfaceVertex>>
Access the surface form
Trait Implementations
sourceimpl<T: Clone + HasPartial> Clone for MaybePartial<T>where
T::Partial: Clone,
impl<T: Clone + HasPartial> Clone for MaybePartial<T>where
T::Partial: Clone,
sourcefn clone(&self) -> MaybePartial<T>
fn clone(&self) -> MaybePartial<T>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl<T: Debug + HasPartial> Debug for MaybePartial<T>where
T::Partial: Debug,
impl<T: Debug + HasPartial> Debug for MaybePartial<T>where
T::Partial: Debug,
sourceimpl From<PartialCurve> for MaybePartial<Curve>
impl From<PartialCurve> for MaybePartial<Curve>
sourcefn from(partial: PartialCurve) -> Self
fn from(partial: PartialCurve) -> Self
sourceimpl From<PartialGlobalEdge> for MaybePartial<GlobalEdge>
impl From<PartialGlobalEdge> for MaybePartial<GlobalEdge>
sourcefn from(partial: PartialGlobalEdge) -> Self
fn from(partial: PartialGlobalEdge) -> Self
sourceimpl From<PartialGlobalVertex> for MaybePartial<GlobalVertex>
impl From<PartialGlobalVertex> for MaybePartial<GlobalVertex>
sourcefn from(partial: PartialGlobalVertex) -> Self
fn from(partial: PartialGlobalVertex) -> Self
sourceimpl From<PartialHalfEdge> for MaybePartial<HalfEdge>
impl From<PartialHalfEdge> for MaybePartial<HalfEdge>
sourcefn from(partial: PartialHalfEdge) -> Self
fn from(partial: PartialHalfEdge) -> Self
sourceimpl From<PartialSurfaceVertex> for MaybePartial<SurfaceVertex>
impl From<PartialSurfaceVertex> for MaybePartial<SurfaceVertex>
sourcefn from(partial: PartialSurfaceVertex) -> Self
fn from(partial: PartialSurfaceVertex) -> Self
sourceimpl From<PartialVertex> for MaybePartial<Vertex>
impl From<PartialVertex> for MaybePartial<Vertex>
sourcefn from(partial: PartialVertex) -> Self
fn from(partial: PartialVertex) -> Self
sourceimpl<T> From<T> for MaybePartial<T>where
T: HasPartial,
impl<T> From<T> for MaybePartial<T>where
T: HasPartial,
sourceimpl<T: Hash + HasPartial> Hash for MaybePartial<T>where
T::Partial: Hash,
impl<T: Hash + HasPartial> Hash for MaybePartial<T>where
T::Partial: Hash,
sourceimpl<T: Ord + HasPartial> Ord for MaybePartial<T>where
T::Partial: Ord,
impl<T: Ord + HasPartial> Ord for MaybePartial<T>where
T::Partial: Ord,
sourcefn cmp(&self, other: &MaybePartial<T>) -> Ordering
fn cmp(&self, other: &MaybePartial<T>) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl<T: PartialEq + HasPartial> PartialEq<MaybePartial<T>> for MaybePartial<T>where
T::Partial: PartialEq,
impl<T: PartialEq + HasPartial> PartialEq<MaybePartial<T>> for MaybePartial<T>where
T::Partial: PartialEq,
sourcefn eq(&self, other: &MaybePartial<T>) -> bool
fn eq(&self, other: &MaybePartial<T>) -> bool
sourceimpl<T: PartialOrd + HasPartial> PartialOrd<MaybePartial<T>> for MaybePartial<T>where
T::Partial: PartialOrd,
impl<T: PartialOrd + HasPartial> PartialOrd<MaybePartial<T>> for MaybePartial<T>where
T::Partial: PartialOrd,
sourcefn partial_cmp(&self, other: &MaybePartial<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &MaybePartial<T>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresourceimpl<T> TransformObject for MaybePartial<T>where
T: HasPartial + TransformObject,
T::Partial: TransformObject,
impl<T> TransformObject for MaybePartial<T>where
T: HasPartial + TransformObject,
T::Partial: TransformObject,
impl<T: Copy + HasPartial> Copy for MaybePartial<T>where
T::Partial: Copy,
impl<T: Eq + HasPartial> Eq for MaybePartial<T>where
T::Partial: Eq,
impl<T: HasPartial> StructuralEq for MaybePartial<T>
impl<T: HasPartial> StructuralPartialEq for MaybePartial<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for MaybePartial<T>where
T: RefUnwindSafe,
<T as HasPartial>::Partial: RefUnwindSafe,
impl<T> Send for MaybePartial<T>where
T: Send,
<T as HasPartial>::Partial: Send,
impl<T> Sync for MaybePartial<T>where
T: Sync,
<T as HasPartial>::Partial: Sync,
impl<T> Unpin for MaybePartial<T>where
T: Unpin,
<T as HasPartial>::Partial: Unpin,
impl<T> UnwindSafe for MaybePartial<T>where
T: UnwindSafe,
<T as HasPartial>::Partial: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read morefn 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. Read morefn 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. Read moreimpl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.