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

Method insert

ctutils/src/ct_option.rs:169–173  ·  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

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