MCPcopy Create free account
hub / github.com/RustCrypto/utils / insert

Method insert

ctutils/src/ct_option.rs:168–172  ·  view source on GitHub ↗

Inserts `value` into the [`CtOption`], then returns a mutable reference to it. If the option already contains a value, the old value is dropped.

(&mut self, value: T)

Source from the content-addressed store, hash-verified

166 ///
167 /// If the option already contains a value, the old value is dropped.
168 pub fn insert(&mut self, value: T) -> &mut T {
169 self.value = value;
170 self.is_some = Choice::TRUE;
171 &mut self.value
172 }
173
174 /// Conditionally inserts `value` into the [`CtOption`] if the given condition holds.
175 pub fn insert_if(&mut self, value: &T, condition: Choice)

Callers 1

insertFunction · 0.80

Calls

no outgoing calls

Tested by 1

insertFunction · 0.64