pub(crate) fn raw_as_mut(&mut self, expected: Hash) -> Result<*mut (), AnyObjError> {
        match self.vtable.kind {
            // Only owned and mutable pointers can be treated as mutable.
            AnyObjKind::Owned | AnyObjKind::MutPtr => (),
            _ => {
                return Err(AnyObjError::RefAsMut {
                    name: self.type_name(),
                })
            }
        }

        // Safety: invariants are checked at construction time.
        // We have mutable access to the inner value because we have mutable
        // access to the `Any`.
        match unsafe { (self.vtable.as_ptr)(self.data, expected) } {
            Some(ptr) => Ok(ptr as *mut ()),
            None => Err(AnyObjError::Cast),
        }
    }
/// Attempt to perform a conversion to a raw mutable pointer.
Attempt to perform a conversion to a raw mutable pointer.
Attempt to perform a conversion to a raw mutable pointer .
pub(crate) fn raw_as_mut(&mut self, expected: Hash) -> Result<*mut (), AnyObjError> {
        match self.vtable.kind {
            // Only owned and mutable pointers can be treated as mutable.
            AnyObjKind::Owned | AnyObjKind::MutPtr => (),
            _ => {
                return Err(AnyObjError::RefAsMut {
                    name: self.type_name(),
                })
            }
        }
        // Safety: invariants are checked at construction time.
        // We have mutable access to the inner value because we have mutable
        // access to the `Any`.
        match unsafe { (self.vtable.as_ptr)(self.data, expected) } {
            Some(ptr) => Ok(ptr as *mut ()),
            None => Err(AnyObjError::Cast),
        }
    }
pub ( crate ) fn raw_as_mut ( & mut self , expected : Hash ) -> Result < * mut ( ) , AnyObjError > { match self . vtable . kind { // Only owned and mutable pointers can be treated as mutable. AnyObjKind :: Owned | AnyObjKind :: MutPtr => ( ) , _ => { return Err ( AnyObjError :: RefAsMut { name : self . type_name ( ) , } ) } } // Safety: invariants are checked at construction time. // We have mutable access to the inner value because we have mutable // access to the `Any`. match unsafe { ( self . vtable . as_ptr ) ( self . data , expected ) } { Some ( ptr ) => Ok ( ptr as * mut ( ) ) , None => Err ( AnyObjError :: Cast ) , } }
Attempt to perform a conversion to a raw mutable pointer.
Attempt to perform a conversion to a raw mutable pointer .
&mut self
expected
Hash
&mut self
expected
Hash