[][src]Struct chemfiles::AtomMut

pub struct AtomMut<'a> { /* fields omitted */ }

An analog to a mutable reference to an atom (&mut Atom)

Methods from Deref<Target = Atom>

pub fn mass(&self) -> f64[src]

Get the atom mass, in atomic mass units.

Example

let atom = Atom::new("He");
assert_eq!(atom.mass(), 4.002602);

pub fn set_mass(&mut self, mass: f64)[src]

Set the atom mass to mass, in atomic mass units.

Example

let mut atom = Atom::new("He");

atom.set_mass(34.9);
assert_eq!(atom.mass(), 34.9);

pub fn charge(&self) -> f64[src]

Get the atom charge, in number of the electron charge e.

Example

let atom = Atom::new("He");
assert_eq!(atom.charge(), 0.0);

pub fn set_charge(&mut self, charge: f64)[src]

Set the atom charge to charge, in number of the electron charge e.

Example

let mut atom = Atom::new("He");

atom.set_charge(-2.0);
assert_eq!(atom.charge(), -2.0);

pub fn name(&self) -> String[src]

Get the atom name.

Example

let atom = Atom::new("He");
assert_eq!(atom.name(), "He");

pub fn atomic_type(&self) -> String[src]

Get the atom type.

Example

let atom = Atom::new("He");
assert_eq!(atom.atomic_type(), "He");

pub fn set_name<'a>(
    &mut self,
    name: impl Into<&'a str>
)
[src]

Set the atom name to name.

Example

let mut atom = Atom::new("He");

atom.set_name("Zn3");
assert_eq!(atom.name(), "Zn3");

pub fn set_atomic_type<'a>(
    &mut self,
    atomic_type: impl Into<&'a str>
)
[src]

Set the atom type to atomic_type.

Example

let mut atom = Atom::new("He");

atom.set_atomic_type("F");
assert_eq!(atom.atomic_type(), "F");

pub fn full_name(&self) -> String[src]

Try to get the full name of the atom from the atomic type. For example, the full name of "He" is "Helium", and so on. If the name can not be found, this function returns the empty string.

Example

let atom = Atom::new("Zn");
assert_eq!(atom.full_name(), "Zinc");

pub fn vdw_radius(&self) -> f64[src]

Try to get the Van der Waals radius of the atom from the atomic type. If the radius can not be found, returns 0.

Example

assert_eq!(Atom::new("He").vdw_radius(), 1.4);
assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);

pub fn covalent_radius(&self) -> f64[src]

Try to get the covalent radius of the atom from the atomic type. If the radius can not be found, returns 0.

Example

assert_eq!(Atom::new("He").covalent_radius(), 0.32);
assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);

pub fn atomic_number(&self) -> u64[src]

Try to get the atomic number of the atom from the atomic type. If the number can not be found, returns 0.

Example

assert_eq!(Atom::new("He").atomic_number(), 2);
assert_eq!(Atom::new("Xxx").atomic_number(), 0);

pub fn set(
    &mut self,
    name: &str,
    property: impl Into<Property>
)
[src]

Add a new property with the given name to this atom.

If a property with the same name already exists, this function override the existing property with the new one.

Examples

let mut atom = Atom::new("He");
atom.set("a bool", true);
atom.set("a string", "test");

assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
assert_eq!(atom.get("a string"), Some(Property::String("test".into())));

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this atom, if it exist.

Examples

let mut atom = Atom::new("He");
atom.set("foo", Property::Double(22.2));

assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
assert_eq!(atom.get("Bar"), None);

Important traits for PropertiesIter<'a>
pub fn properties(&self) -> PropertiesIter[src]

Get an iterator over all (name, property) pairs for this atom

Examples

let mut atom = Atom::new("He");
atom.set("foo", Property::Double(22.2));
atom.set("bar", Property::Bool(false));

for (name, property) in atom.properties() {
    if name == "foo" {
        assert_eq!(property, Property::Double(22.2));
    } else if name == "bar" {
        assert_eq!(property, Property::Bool(false));
    }
}

Trait Implementations

impl<'a> DerefMut for AtomMut<'a>[src]

impl<'a> Deref for AtomMut<'a>[src]

type Target = Atom

The resulting type after dereferencing.

Auto Trait Implementations

impl<'a> !Send for AtomMut<'a>

impl<'a> !Sync for AtomMut<'a>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]