pub struct PersistableBundle(/* private fields */);Expand description
A mapping from string keys to values of various types.
Implementations§
Source§impl PersistableBundle
impl PersistableBundle
Sourcepub fn remove(&mut self, key: &str) -> Result<bool, NulError>
pub fn remove(&mut self, key: &str) -> Result<bool, NulError>
Removes any entry with the given key.
Returns an error if the given key contains a NUL character, otherwise returns whether there was any entry to remove.
Sourcepub fn insert_bool(&mut self, key: &str, value: bool) -> Result<(), NulError>
pub fn insert_bool(&mut self, key: &str, value: bool) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_int(&mut self, key: &str, value: i32) -> Result<(), NulError>
pub fn insert_int(&mut self, key: &str, value: i32) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_long(&mut self, key: &str, value: i64) -> Result<(), NulError>
pub fn insert_long(&mut self, key: &str, value: i64) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_double(&mut self, key: &str, value: f64) -> Result<(), NulError>
pub fn insert_double(&mut self, key: &str, value: f64) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_string(&mut self, key: &str, value: &str) -> Result<(), NulError>
pub fn insert_string(&mut self, key: &str, value: &str) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key or value contains a NUL character.
Sourcepub fn insert_bool_vec(
&mut self,
key: &str,
value: &[bool],
) -> Result<(), NulError>
pub fn insert_bool_vec( &mut self, key: &str, value: &[bool], ) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_int_vec(
&mut self,
key: &str,
value: &[i32],
) -> Result<(), NulError>
pub fn insert_int_vec( &mut self, key: &str, value: &[i32], ) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_long_vec(
&mut self,
key: &str,
value: &[i64],
) -> Result<(), NulError>
pub fn insert_long_vec( &mut self, key: &str, value: &[i64], ) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_double_vec(
&mut self,
key: &str,
value: &[f64],
) -> Result<(), NulError>
pub fn insert_double_vec( &mut self, key: &str, value: &[f64], ) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_string_vec<'a, T: ToString + 'a>(
&mut self,
key: &str,
value: impl IntoIterator<Item = &'a T>,
) -> Result<(), NulError>
pub fn insert_string_vec<'a, T: ToString + 'a>( &mut self, key: &str, value: impl IntoIterator<Item = &'a T>, ) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn insert_persistable_bundle(
&mut self,
key: &str,
value: &PersistableBundle,
) -> Result<(), NulError>
pub fn insert_persistable_bundle( &mut self, key: &str, value: &PersistableBundle, ) -> Result<(), NulError>
Inserts a key-value pair into the bundle.
If the key is already present then its value will be overwritten by the given value.
Returns an error if the key contains a NUL character.
Sourcepub fn get_bool(&self, key: &str) -> Result<Option<bool>, NulError>
pub fn get_bool(&self, key: &str) -> Result<Option<bool>, NulError>
Gets the boolean value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_int(&self, key: &str) -> Result<Option<i32>, NulError>
pub fn get_int(&self, key: &str) -> Result<Option<i32>, NulError>
Gets the i32 value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_long(&self, key: &str) -> Result<Option<i64>, NulError>
pub fn get_long(&self, key: &str) -> Result<Option<i64>, NulError>
Gets the i64 value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_double(&self, key: &str) -> Result<Option<f64>, NulError>
pub fn get_double(&self, key: &str) -> Result<Option<f64>, NulError>
Gets the f64 value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_string(&self, key: &str) -> Result<Option<String>, NulError>
pub fn get_string(&self, key: &str) -> Result<Option<String>, NulError>
Gets the string value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_bool_vec(&self, key: &str) -> Result<Option<Vec<bool>>, NulError>
pub fn get_bool_vec(&self, key: &str) -> Result<Option<Vec<bool>>, NulError>
Gets the boolean vector value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_int_vec(&self, key: &str) -> Result<Option<Vec<i32>>, NulError>
pub fn get_int_vec(&self, key: &str) -> Result<Option<Vec<i32>>, NulError>
Gets the i32 vector value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_long_vec(&self, key: &str) -> Result<Option<Vec<i64>>, NulError>
pub fn get_long_vec(&self, key: &str) -> Result<Option<Vec<i64>>, NulError>
Gets the i64 vector value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_double_vec(&self, key: &str) -> Result<Option<Vec<f64>>, NulError>
pub fn get_double_vec(&self, key: &str) -> Result<Option<Vec<f64>>, NulError>
Gets the f64 vector value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_string_vec(&self, key: &str) -> Result<Option<Vec<String>>, NulError>
pub fn get_string_vec(&self, key: &str) -> Result<Option<Vec<String>>, NulError>
Gets the string vector value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn get_persistable_bundle(
&self,
key: &str,
) -> Result<Option<Self>, NulError>
pub fn get_persistable_bundle( &self, key: &str, ) -> Result<Option<Self>, NulError>
Gets the PersistableBundle value associated with the given key.
Returns an error if the key contains a NUL character, or Ok(None) if the key doesn’t exist
in the bundle.
Sourcepub fn keys_for_type(&self, value_type: ValueType) -> Vec<String>
pub fn keys_for_type(&self, value_type: ValueType) -> Vec<String>
Gets all the keys associated with values of the given type.
Trait Implementations§
Source§impl Clone for PersistableBundle
impl Clone for PersistableBundle
Source§impl Debug for PersistableBundle
impl Debug for PersistableBundle
Source§impl Default for PersistableBundle
impl Default for PersistableBundle
Source§impl Deserialize for PersistableBundle
impl Deserialize for PersistableBundle
Source§type UninitType = Option<PersistableBundle>
type UninitType = Option<PersistableBundle>
Self
if the type implements Default, Option<Self> otherwise.Source§fn uninit() -> Self::UninitType
fn uninit() -> Self::UninitType
Source§fn from_init(value: Self) -> Self::UninitType
fn from_init(value: Self) -> Self::UninitType
Self into Self::UninitType.Source§fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>
fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>
crate::parcel::Parcel.Source§fn deserialize_from(
&mut self,
parcel: &BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn deserialize_from( &mut self, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>
crate::parcel::Parcel onto the
current object. This operation will overwrite the old value
partially or completely, depending on how much data is available.Source§const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _
const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _
Self and Self::UninitType have the same
size and alignment. This will either fail to compile or evaluate to true.
The only two macros that work here are panic! and assert!, so we cannot
use assert_eq!.Source§impl DeserializeArray for PersistableBundle
impl DeserializeArray for PersistableBundle
Source§fn deserialize_array(
parcel: &BorrowedParcel<'_>,
) -> Result<Option<Vec<Self>>, StatusCode>
fn deserialize_array( parcel: &BorrowedParcel<'_>, ) -> Result<Option<Vec<Self>>, StatusCode>
Source§impl DeserializeOption for PersistableBundle
impl DeserializeOption for PersistableBundle
Source§fn deserialize_option(
parcel: &BorrowedParcel<'_>,
) -> Result<Option<Self>, StatusCode>
fn deserialize_option( parcel: &BorrowedParcel<'_>, ) -> Result<Option<Self>, StatusCode>
Source§fn deserialize_option_from(
this: &mut Option<Self>,
parcel: &BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn deserialize_option_from( this: &mut Option<Self>, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Source§impl Drop for PersistableBundle
impl Drop for PersistableBundle
Source§impl PartialEq for PersistableBundle
impl PartialEq for PersistableBundle
Source§impl Serialize for PersistableBundle
impl Serialize for PersistableBundle
Source§fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<(), StatusCode>
fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<(), StatusCode>
crate::parcel::Parcel.Source§impl SerializeArray for PersistableBundle
impl SerializeArray for PersistableBundle
Source§fn serialize_array(
slice: &[Self],
parcel: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn serialize_array( slice: &[Self], parcel: &mut BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Source§impl SerializeOption for PersistableBundle
impl SerializeOption for PersistableBundle
Source§fn serialize_option(
this: Option<&Self>,
parcel: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn serialize_option( this: Option<&Self>, parcel: &mut BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Source§impl UnstructuredParcelable for PersistableBundle
impl UnstructuredParcelable for PersistableBundle
Source§fn write_to_parcel(
&self,
parcel: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn write_to_parcel( &self, parcel: &mut BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Source§fn from_parcel(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>
fn from_parcel(parcel: &BorrowedParcel<'_>) -> Result<Self, StatusCode>
Source§fn read_from_parcel(
&mut self,
parcel: &BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn read_from_parcel( &mut self, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>
impl Send for PersistableBundle
impl Sync for PersistableBundle
Auto Trait Implementations§
impl Freeze for PersistableBundle
impl RefUnwindSafe for PersistableBundle
impl Unpin for PersistableBundle
impl UnwindSafe for PersistableBundle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.