Handle

Struct Handle 

Source
pub struct Handle<T> { /* private fields */ }
Expand description

A handle for an object

You can get an instance of Handle by inserting an object into a store. A handle dereferences to the object it points to, via its Deref implementation.

§Equality and Identity

Equality of Handles is defined via the objects they reference. If those objects are equal, the Handles are considered equal.

This is distinct from the identity of the referenced objects. Two objects might be equal, but they might be have been created at different times, for different reasons, and thus live in different slots in the storage. This is a relevant distinction when validating objects, as equal but not identical objects might be a sign of a bug.

You can compare the identity of two objects through their Handles, by comparing the values returned by Handle::id.

Implementations§

Source§

impl<T> Handle<T>

Source

pub fn id(&self) -> ObjectId

Access this pointer’s unique id

Source

pub fn clone_object(&self) -> T
where T: Clone,

Return a clone of the object this handle refers to

Trait Implementations§

Source§

impl<T> Clone for Handle<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Handle<T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for Handle<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Extend<Handle<Face>> for FaceSet

Source§

fn extend<T: IntoIterator<Item = Handle<Face>>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<Handle<Cycle>> for Object<BehindHandle>

Source§

fn from(object: Handle<Cycle>) -> Self

Converts to this type from the input type.
Source§

impl From<Handle<Face>> for Object<BehindHandle>

Source§

fn from(object: Handle<Face>) -> Self

Converts to this type from the input type.
Source§

impl From<Handle<GlobalEdge>> for Object<BehindHandle>

Source§

fn from(object: Handle<GlobalEdge>) -> Self

Converts to this type from the input type.
Source§

impl From<Handle<HalfEdge>> for Object<BehindHandle>

Source§

fn from(object: Handle<HalfEdge>) -> Self

Converts to this type from the input type.
Source§

impl From<Handle<Shell>> for Object<BehindHandle>

Source§

fn from(object: Handle<Shell>) -> Self

Converts to this type from the input type.
Source§

impl From<Handle<Sketch>> for Object<BehindHandle>

Source§

fn from(object: Handle<Sketch>) -> Self

Converts to this type from the input type.
Source§

impl From<Handle<Solid>> for Object<BehindHandle>

Source§

fn from(object: Handle<Solid>) -> Self

Converts to this type from the input type.
Source§

impl From<Handle<Surface>> for Object<BehindHandle>

Source§

fn from(object: Handle<Surface>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Handle<T>> for HandleWrapper<T>

Source§

fn from(handle: Handle<T>) -> Self

Converts to this type from the input type.
Source§

impl From<Handle<Vertex>> for Object<BehindHandle>

Source§

fn from(object: Handle<Vertex>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<HandleWrapper<T>> for Handle<T>

Source§

fn from(wrapper: HandleWrapper<T>) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Handle<Face>> for FaceSet

Source§

fn from_iter<T: IntoIterator<Item = Handle<Face>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<T> Hash for Handle<T>
where T: Hash,

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Ord for Handle<T>
where T: Ord,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T> PartialEq for Handle<T>
where T: PartialEq,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> PartialOrd for Handle<T>
where T: PartialOrd,

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Reverse for Handle<Cycle>

Source§

fn reverse(self, services: &mut Services) -> Self

Reverse the direction/orientation of the object
Source§

impl Reverse for Handle<Face>

Source§

fn reverse(self, services: &mut Services) -> Self

Reverse the direction/orientation of the object
Source§

impl Sweep for Handle<Face>

Source§

type Swept = Handle<Shell>

The object that is created by sweeping the implementing object
Source§

fn sweep_with_cache( self, path: impl Into<Vector<3>>, cache: &mut SweepCache, services: &mut Services, ) -> Self::Swept

Sweep the object along the given path, using the provided cache
Source§

fn sweep( self, path: impl Into<Vector<3>>, services: &mut Services, ) -> Self::Swept

Sweep the object along the given path
Source§

impl Sweep for Handle<Sketch>

Source§

type Swept = Handle<Solid>

The object that is created by sweeping the implementing object
Source§

fn sweep_with_cache( self, path: impl Into<Vector<3>>, cache: &mut SweepCache, services: &mut Services, ) -> Self::Swept

Sweep the object along the given path, using the provided cache
Source§

fn sweep( self, path: impl Into<Vector<3>>, services: &mut Services, ) -> Self::Swept

Sweep the object along the given path
Source§

impl Sweep for Handle<Vertex>

Source§

type Swept = (Handle<GlobalEdge>, [Handle<Vertex>; 2])

The object that is created by sweeping the implementing object
Source§

fn sweep_with_cache( self, _: impl Into<Vector<3>>, cache: &mut SweepCache, services: &mut Services, ) -> Self::Swept

Sweep the object along the given path, using the provided cache
Source§

fn sweep( self, path: impl Into<Vector<3>>, services: &mut Services, ) -> Self::Swept

Sweep the object along the given path
Source§

impl<T> TransformObject for Handle<T>
where T: Clone + Insert<Inserted = Handle<T>> + TransformObject + 'static,

Source§

fn transform_with_cache( self, transform: &Transform, services: &mut Services, cache: &mut TransformCache, ) -> Self

Transform the object using the provided cache
Source§

fn transform(self, transform: &Transform, services: &mut Services) -> Self

Transform the object
Source§

fn translate( self, offset: impl Into<Vector<3>>, services: &mut Services, ) -> Self

Translate the object Read more
Source§

fn rotate( self, axis_angle: impl Into<Vector<3>>, services: &mut Services, ) -> Self

Rotate the object Read more
Source§

impl<T> Eq for Handle<T>
where T: Eq,

Source§

impl<T> Send for Handle<T>

Source§

impl<T> Sync for Handle<T>

Auto Trait Implementations§

§

impl<T> Freeze for Handle<T>

§

impl<T> !RefUnwindSafe for Handle<T>

§

impl<T> Unpin for Handle<T>

§

impl<T> !UnwindSafe for Handle<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,