pub struct AtomCollection<T: ModelInfo> { /* private fields */ }
Expand description

Struct of Atom as data-driven design.

Implementations§

Update the element_symbol at the given index.

Errors

This function will return an error if the index is out of bounds.

Examples found in repository?
src/atom/mod.rs (line 146)
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
    pub fn update_atom_at(&mut self, index: usize, new_atom: Atom<T>) -> Result<(), InvalidIndex> {
        let Atom {
            element_symbol,
            atomic_number: element_id,
            xyz,
            fractional_xyz,
            atom_id,
            format_type: _,
        } = new_atom;
        self.update_symbol_at(index, &element_symbol)?;
        self.update_elm_id_at(index, element_id)?;
        self.update_xyz_at(index, xyz)?;
        self.update_frac_xyz_at(index, fractional_xyz)?;
        self.update_atom_id_at(index, atom_id)?;
        Ok(())
    }

Update the element_id at the given index.

Errors

This function will return an error if the index is out of bounds.

Examples found in repository?
src/atom/mod.rs (line 147)
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
    pub fn update_atom_at(&mut self, index: usize, new_atom: Atom<T>) -> Result<(), InvalidIndex> {
        let Atom {
            element_symbol,
            atomic_number: element_id,
            xyz,
            fractional_xyz,
            atom_id,
            format_type: _,
        } = new_atom;
        self.update_symbol_at(index, &element_symbol)?;
        self.update_elm_id_at(index, element_id)?;
        self.update_xyz_at(index, xyz)?;
        self.update_frac_xyz_at(index, fractional_xyz)?;
        self.update_atom_id_at(index, atom_id)?;
        Ok(())
    }

Update the xyz at the given index.

Errors

This function will return an error if the index is out of bounds.

Examples found in repository?
src/atom/mod.rs (line 148)
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
    pub fn update_atom_at(&mut self, index: usize, new_atom: Atom<T>) -> Result<(), InvalidIndex> {
        let Atom {
            element_symbol,
            atomic_number: element_id,
            xyz,
            fractional_xyz,
            atom_id,
            format_type: _,
        } = new_atom;
        self.update_symbol_at(index, &element_symbol)?;
        self.update_elm_id_at(index, element_id)?;
        self.update_xyz_at(index, xyz)?;
        self.update_frac_xyz_at(index, fractional_xyz)?;
        self.update_atom_id_at(index, atom_id)?;
        Ok(())
    }

Update the fractional_xyz at the given index.

Errors

This function will return an error if the index is out of bounds.

Examples found in repository?
src/atom/mod.rs (line 149)
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
    pub fn update_atom_at(&mut self, index: usize, new_atom: Atom<T>) -> Result<(), InvalidIndex> {
        let Atom {
            element_symbol,
            atomic_number: element_id,
            xyz,
            fractional_xyz,
            atom_id,
            format_type: _,
        } = new_atom;
        self.update_symbol_at(index, &element_symbol)?;
        self.update_elm_id_at(index, element_id)?;
        self.update_xyz_at(index, xyz)?;
        self.update_frac_xyz_at(index, fractional_xyz)?;
        self.update_atom_id_at(index, atom_id)?;
        Ok(())
    }

Update the atom_id at the given index.

Errors

This function will return an error if the index is out of bounds.

Examples found in repository?
src/atom/mod.rs (line 150)
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
    pub fn update_atom_at(&mut self, index: usize, new_atom: Atom<T>) -> Result<(), InvalidIndex> {
        let Atom {
            element_symbol,
            atomic_number: element_id,
            xyz,
            fractional_xyz,
            atom_id,
            format_type: _,
        } = new_atom;
        self.update_symbol_at(index, &element_symbol)?;
        self.update_elm_id_at(index, element_id)?;
        self.update_xyz_at(index, xyz)?;
        self.update_frac_xyz_at(index, fractional_xyz)?;
        self.update_atom_id_at(index, atom_id)?;
        Ok(())
    }

Update the whole atom at the given index.

Errors

This function will return an error if the index is out of bounds.

Examples found in repository?
src/model_type/msi.rs (line 85)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/atom/visitor.rs (line 64)
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
    fn view_atom_at_index(&self, index: usize) -> Result<AtomView<T>, InvalidIndex> {
        let element_symbol = self
            .element_symbols()
            .get(index)
            .ok_or(InvalidIndex)?
            .as_str();
        let element_id = self.atomic_nums.get(index).ok_or(InvalidIndex)?;
        let xyz = self.xyz_coords.get(index).ok_or(InvalidIndex)?;
        let fractional_xyz = self.fractional_xyz.get(index).ok_or(InvalidIndex)?.as_ref();
        let atom_id = self.atom_ids.get(index).ok_or(InvalidIndex)?;
        Ok(AtomView {
            element_symbol,
            atomic_number: element_id,
            xyz,
            fractional_xyz,
            atom_id,
            format_type: T::default(),
        })
    }
    fn view_atom_by_id(&self, atom_id: u32) -> Result<AtomView<T>, InvalidIndex> {
        let index = (atom_id - 1) as usize;
        self.view_atom_at_index(index)
    }

    fn get_vector_ab(&self, a_id: u32, b_id: u32) -> Result<Vector3<f64>, InvalidIndex> {
        if a_id != b_id {
            let atom_a_xyz = self.get_xyz_by_id(a_id).unwrap();
            let atom_b_xyz = self.get_xyz_by_id(b_id).unwrap();
            Ok(atom_b_xyz - atom_a_xyz)
        } else {
            Err(InvalidIndex)
        }
    }

    fn element_set(&self) -> Vec<String> {
        let mut elm_list: Vec<(String, u8)> = vec![];
        elm_list.extend(
            self.element_symbols()
                .iter()
                .zip(self.atomic_nums().iter())
                .map(|(sym, id)| (sym.to_string(), *id))
                .collect::<Vec<(String, u8)>>()
                .drain(..)
                .collect::<HashSet<(String, u8)>>()
                .into_iter(),
        );
        elm_list.sort_unstable_by(|a, b| {
            let (_, id_a) = a;
            let (_, id_b) = b;
            id_a.cmp(id_b)
        });
        elm_list
            .iter()
            .map(|(name, _)| name.to_string())
            .collect::<Vec<String>>()
    }

    fn spin_total(&self) -> u8 {
        self.element_symbols()
            .iter()
            .map(|symbol| -> u8 { ELEMENT_TABLE.get_by_symbol(symbol).unwrap().spin })
            .reduce(|total, next| total + next)
            .unwrap()
    }
src/model_type/cell.rs (line 250)
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let all_positions_str: Vec<String> = self
            .element_symbols()
            .iter()
            .zip(self.fractional_xyz().iter())
            .map(|(symbol, frac_xyz)| -> String {
                let spin = ELEMENT_TABLE.get_by_symbol(symbol).unwrap().spin();
                let spin_str = if spin > 0 {
                    format!(" SPIN={:14.10}", spin)
                } else {
                    "".into()
                };
                let frac_xyz = frac_xyz.unwrap();
                format!(
                    "{:>3}{:20.16}{:20.16}{:20.16}{spin_str}",
                    symbol, frac_xyz.x, frac_xyz.y, frac_xyz.z
                )
            })
            .collect();
        let joined_positions_str = all_positions_str.join("\n");
        write!(f, "{}", joined_positions_str)
    }
Examples found in repository?
src/model_type/msi.rs (line 87)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/atom/visitor.rs (line 101)
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
    fn element_set(&self) -> Vec<String> {
        let mut elm_list: Vec<(String, u8)> = vec![];
        elm_list.extend(
            self.element_symbols()
                .iter()
                .zip(self.atomic_nums().iter())
                .map(|(sym, id)| (sym.to_string(), *id))
                .collect::<Vec<(String, u8)>>()
                .drain(..)
                .collect::<HashSet<(String, u8)>>()
                .into_iter(),
        );
        elm_list.sort_unstable_by(|a, b| {
            let (_, id_a) = a;
            let (_, id_b) = b;
            id_a.cmp(id_b)
        });
        elm_list
            .iter()
            .map(|(name, _)| name.to_string())
            .collect::<Vec<String>>()
    }
Examples found in repository?
src/atom/visitor.rs (line 18)
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
pub fn get_xyz_by_id<T: ModelInfo>(
    atom_collection: &AtomCollection<T>,
    atom_id: u32,
) -> Option<&Point3<f64>> {
    atom_collection.xyz_coords().get((atom_id - 1) as usize)
}

pub fn get_multiple_xyz_by_id<'a, 'b, T: ModelInfo>(
    atom_collection: &'a AtomCollection<T>,
    atom_ids: &'b [u32],
) -> Vec<Option<&'a Point3<f64>>> {
    atom_ids
        .iter()
        .map(|&id| atom_collection.xyz_coords().get((id - 1) as usize))
        .collect()
}

pub trait VisitCollection<T: ModelInfo> {
    fn get_xyz_by_id(&self, atom_id: u32) -> Option<&Point3<f64>>;
    fn get_multiple_xyz_by_id<'a, 'b>(
        &'a self,
        atom_ids: &'b [u32],
    ) -> Vec<Option<&'a Point3<f64>>>;
    fn view_atom_at_index(&self, index: usize) -> Result<AtomView<T>, InvalidIndex>;
    fn view_atom_by_id(&self, atom_id: u32) -> Result<AtomView<T>, InvalidIndex>;
    fn get_vector_ab(&self, a_id: u32, b_id: u32) -> Result<Vector3<f64>, InvalidIndex>;
    fn element_set(&self) -> Vec<String>;
    fn spin_total(&self) -> u8;
    fn get_final_cutoff_energy(&self, potentials_loc: &str) -> Result<f64, io::Error>;
}

impl<T> VisitCollection<T> for AtomCollection<T>
where
    T: ModelInfo,
{
    fn get_xyz_by_id(&self, atom_id: u32) -> Option<&Point3<f64>> {
        self.xyz_coords().get((atom_id - 1) as usize)
    }

    fn get_multiple_xyz_by_id<'a, 'b>(
        &'a self,
        atom_ids: &'b [u32],
    ) -> Vec<Option<&'a Point3<f64>>> {
        atom_ids
            .iter()
            .map(|&id| self.xyz_coords().get((id - 1) as usize))
            .collect()
    }
More examples
Hide additional examples
src/model_type/msi.rs (line 89)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
src/model_type/cell.rs (line 67)
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    fn from(mut msi_model: T) -> Self {
        let x_axis: Vector3<f64> = Vector::x();
        let a_vec = msi_model
            .as_ref()
            .lattice_vectors()
            .unwrap()
            .vectors()
            .column(0);
        let a_to_x_angle = a_vec.angle(&x_axis);
        if a_to_x_angle != 0.0 {
            let rot_axis = a_vec.cross(&x_axis).normalize();
            let rot_quatd: UnitQuaternion<f64> = UnitQuaternion::new(rot_axis * a_to_x_angle);
            msi_model.as_mut().rotate(&rot_quatd);
        }
        let new_lat_vec = LatticeVectors::new(
            msi_model
                .as_ref()
                .lattice_vectors()
                .unwrap()
                .vectors()
                .to_owned(),
        );
        let fractional_coord_matrix = msi_model
            .as_ref()
            .lattice_vectors()
            .unwrap()
            .fractional_coord_matrix();
        let mut cell_atoms: AtomCollection<CellModel> = msi_model.as_ref().atoms().clone().into();
        let frac_coords: Vec<Point3<f64>> = cell_atoms
            .xyz_coords()
            .iter()
            .map(|xyz| fractional_coord_matrix * xyz)
            .collect();
        cell_atoms
            .fractional_xyz_mut()
            .iter_mut()
            .enumerate()
            .for_each(|(i, f_xyz)| {
                *f_xyz = Some(*frac_coords.get(i).unwrap());
            });
        Self::new(Some(new_lat_vec), cell_atoms, Settings::default())
    }
Examples found in repository?
src/model_type/msi.rs (line 91)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
More examples
Hide additional examples
src/model_type/cell.rs (line 252)
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let all_positions_str: Vec<String> = self
            .element_symbols()
            .iter()
            .zip(self.fractional_xyz().iter())
            .map(|(symbol, frac_xyz)| -> String {
                let spin = ELEMENT_TABLE.get_by_symbol(symbol).unwrap().spin();
                let spin_str = if spin > 0 {
                    format!(" SPIN={:14.10}", spin)
                } else {
                    "".into()
                };
                let frac_xyz = frac_xyz.unwrap();
                format!(
                    "{:>3}{:20.16}{:20.16}{:20.16}{spin_str}",
                    symbol, frac_xyz.x, frac_xyz.y, frac_xyz.z
                )
            })
            .collect();
        let joined_positions_str = all_positions_str.join("\n");
        write!(f, "{}", joined_positions_str)
    }
Examples found in repository?
src/model_type/cell.rs (line 72)
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    fn from(mut msi_model: T) -> Self {
        let x_axis: Vector3<f64> = Vector::x();
        let a_vec = msi_model
            .as_ref()
            .lattice_vectors()
            .unwrap()
            .vectors()
            .column(0);
        let a_to_x_angle = a_vec.angle(&x_axis);
        if a_to_x_angle != 0.0 {
            let rot_axis = a_vec.cross(&x_axis).normalize();
            let rot_quatd: UnitQuaternion<f64> = UnitQuaternion::new(rot_axis * a_to_x_angle);
            msi_model.as_mut().rotate(&rot_quatd);
        }
        let new_lat_vec = LatticeVectors::new(
            msi_model
                .as_ref()
                .lattice_vectors()
                .unwrap()
                .vectors()
                .to_owned(),
        );
        let fractional_coord_matrix = msi_model
            .as_ref()
            .lattice_vectors()
            .unwrap()
            .fractional_coord_matrix();
        let mut cell_atoms: AtomCollection<CellModel> = msi_model.as_ref().atoms().clone().into();
        let frac_coords: Vec<Point3<f64>> = cell_atoms
            .xyz_coords()
            .iter()
            .map(|xyz| fractional_coord_matrix * xyz)
            .collect();
        cell_atoms
            .fractional_xyz_mut()
            .iter_mut()
            .enumerate()
            .for_each(|(i, f_xyz)| {
                *f_xyz = Some(*frac_coords.get(i).unwrap());
            });
        Self::new(Some(new_lat_vec), cell_atoms, Settings::default())
    }
Examples found in repository?
src/model_type/cell.rs (line 243)
242
243
244
    pub fn build_trjaux(&self) -> TrjAux {
        TrjAux::new(self.atoms().atom_ids().to_vec())
    }
More examples
Hide additional examples
src/model_type/msi.rs (line 93)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
Examples found in repository?
src/model_type/msi.rs (line 83)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
    fn from(src: T) -> Self {
        let builder = AtomCollectionBuilder::<MsiModel, No>::new(src.as_ref().size());
        builder
            .with_element_symbols(src.as_ref().element_symbols())
            .unwrap()
            .with_atomic_nums(src.as_ref().atomic_nums())
            .unwrap()
            .with_xyz_coords(src.as_ref().xyz_coords())
            .unwrap()
            .with_fractional_xyz(src.as_ref().fractional_xyz())
            .unwrap()
            .with_atom_ids(src.as_ref().atom_ids())
            .unwrap()
            .finish()
            .unwrap()
            .build()
    }
}

impl<T> From<T> for LatticeModel<MsiModel>
where
    T: AsRef<LatticeModel<CellModel>>,
{
    fn from(cell_model: T) -> Self {
        let new_lat_vec = LatticeVectors::new(
            cell_model
                .as_ref()
                .lattice_vectors()
                .unwrap()
                .vectors()
                .to_owned(),
        );
        // Convert the SoA to AoS for easier sorting.
        let msi_atoms: AtomCollection<MsiModel> = cell_model.as_ref().atoms().into();
        let mut msi_atom_array: Vec<Atom<MsiModel>> = msi_atoms.into();
        msi_atom_array.sort_by_key(|a| a.atom_id());
        // Convert AoS back to SoA.
        let msi_atom_collection: AtomCollection<MsiModel> = msi_atom_array.into();
        let mut msi_model = Self::new(Some(new_lat_vec), msi_atom_collection, Settings::default());
        let y_axis: Vector3<f64> = Vector::y();
        let b_vec = cell_model
            .as_ref()
            .lattice_vectors()
            .unwrap()
            .vectors()
            .column(1);
        let b_to_y_angle = b_vec.angle(&y_axis);
        if b_to_y_angle != 0.0 {
            let rot_axis = b_vec.cross(&y_axis).normalize();
            let rot_quatd: UnitQuaternion<f64> = UnitQuaternion::new(rot_axis * b_to_y_angle);
            msi_model.rotate(&rot_quatd);
        }
        msi_model
    }
}

impl<T> DefaultExport<MsiModel> for T
where
    T: AsRef<LatticeModel<MsiModel>>,
{
    fn export(&self) -> String {
        if let Some(lattice_vectors) = self.as_ref().lattice_vectors() {
            let headers_vectors: Vec<String> = vec![
                "# MSI CERIUS2 DataModel File Version 4 0\n".to_string(),
                "(1 Model\n".to_string(),
                "  (A I CRY/DISPLAY (192 256))\n".to_string(),
                format!(
                    "  (A I PeriodicType {})\n",
                    self.as_ref().settings().periodic_type()
                ),
                format!(
                    "  (A C SpaceGroup \"{}\")\n",
                    self.as_ref().settings().space_group()
                ),
                format!("{}", lattice_vectors),
                format!(
                    "  (A D CRY/TOLERANCE {})\n",
                    self.as_ref().settings().cry_tolerance()
                ),
            ];
            format!("{}{})", headers_vectors.concat(), self.as_ref().atoms())
        } else {
            let headers = "# MSI CERIUS2 DataModel File Version 4 0\n(1 Model\n";
            format!("{}{})", headers, self.as_ref().atoms())
        }
    }
}

impl<'a> Display for AtomView<'a, MsiModel> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            r#"  ({item_id} Atom
    (A C ACL "{elm_id} {elm}")
    (A C Label "{elm}")
    (A D XYZ ({x:.12} {y:.12} {z:.12}))
    (A I Id {atom_id})
  )
"#,
            item_id = self.atom_id() + 1,
            elm_id = self.atomic_number(),
            elm = self.element_symbol(),
            x = self.xyz().x,
            y = self.xyz().y,
            z = self.xyz().z,
            atom_id = self.atom_id(),
        )
    }
}

impl Display for AtomCollection<MsiModel> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let msi_atom_strings: Vec<String> = (0..self.size())
            .into_iter()
            .map(|i| {
                let atom_view = self.view_atom_at_index(i).unwrap();
                format!("{}", atom_view)
            })
            .collect();
        write!(f, "{}", msi_atom_strings.concat())
    }

Trait Implementations§

The resulting type after applying the + operator.
Performs the + operation. Read more
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.