Skip to main content

Dftd4Structure

Struct Dftd4Structure 

Source
pub struct Dftd4Structure(pub dftd4_structure);
Expand description

Safe wrapper for dftd4_structure handle that automatically frees on drop

Tuple Fields§

§0: dftd4_structure

Implementations§

Source§

impl Dftd4Structure

Source

pub unsafe fn try_new( error: dftd4_error, natoms: c_int, numbers: *const c_int, positions: *const c_double, charge: *const c_double, lattice: *const c_double, periodic: *const bool, ) -> Result<Self, Dftd4StructureError>

Checked creation of molecular structure data (quantities in Bohr).

Behaves exactly like dftd4_new_structure, except that the degenerate inputs the pinned upstream cannot report through the error handle are rejected before the FFI call and returned as a catchable Rust error:

Conditions upstream does report (e.g. “unsupported element” for atomic numbers 104..=111, too close interatomic distances) still come through error exactly as with the raw call — consult the handle after an Ok result as usual. A rejected input leaves error untouched.

§Safety

Same requirements as dftd4_new_structure, except that error must not be null here: error must be a valid error handle created by dftd4_new_error, numbers must point to an array of at least natoms atomic numbers, positions to an array of at least 3 * natoms Cartesian coordinates in Bohr, and charge (one value), lattice (3 * 3 values) and periodic (3 values) must each be either null or point to valid storage. (A null error is rejected with Dftd4StructureError::MissingErrorHandle instead of silently producing a null handle wrapped in Ok, as the raw call does — see the note above and on dftd4_new_structure.)

Trait Implementations§

Source§

impl Drop for Dftd4Structure

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.