Struct pickledb::PickleDbListExtender [−][src]
A struct for extending PickleDB lists and adding more items to them
Implementations
impl<'a> PickleDbListExtender<'a>
[src]
pub fn ladd<V>(&mut self, value: &V) -> PickleDbListExtender<'_> where
V: Serialize,
[src]
V: Serialize,
Add a single item to an existing list.
As mentioned before, the lists are heterogeneous, meaning a single list can contain
items of different types. That means that the item can be of any type that is serializable.
That includes all primitive types, vectors, tuples and every struct that has the
#[derive(Serialize, Deserialize)
attribute.
The method returns another PickleDbListExtender
object that enables to continue adding
items to the list.
Arguments
value
- a reference of the item to add to the list
Examples
// create a new list db.lcreate("list1").unwrap() // add items of different types to the list .ladd(&100) .ladd(&String::from("my string")) .ladd(&vec!["aa", "bb", "cc"]);
pub fn lextend<'i, V, I>(&mut self, seq: I) -> PickleDbListExtender<'_> where
V: 'i + Serialize,
I: IntoIterator<Item = &'i V>,
[src]
V: 'i + Serialize,
I: IntoIterator<Item = &'i V>,
Add multiple items to an existing list.
As mentioned before, the lists are heterogeneous, meaning a single list can contain
items of different types. That means that the item can be of any type that is serializable.
That includes all primitive types, vectors, tuples and every struct that has the
#[derive(Serialize, Deserialize)
attribute.
This method adds multiple items to the list, but since they’re in a vector that means all
of them are of the same type. Of course it doesn’t mean that the list cannot contain items
of other types as well, as you can see in the example below.
The method returns another PickleDbListExtender
object that enables to continue adding
items to the list.
Arguments
seq
- an iterator containing references to the new items to add to the list
Examples
// create a new list db.lcreate("list1"); // add a bunch of numbers to the list db.lextend("list1", &vec![100, 200, 300]).unwrap() // add a bunch of strings to the list .lextend(&vec!["aa", "bb", "cc"]); // now the list contains 6 items and looks like this: [100, 200, 300, "aa, "bb", "cc"]
Auto Trait Implementations
impl<'a> RefUnwindSafe for PickleDbListExtender<'a>
impl<'a> Send for PickleDbListExtender<'a>
impl<'a> Sync for PickleDbListExtender<'a>
impl<'a> Unpin for PickleDbListExtender<'a>
impl<'a> !UnwindSafe for PickleDbListExtender<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,