pub struct PickleDbListExtender<'a> { /* private fields */ }
Expand description

A struct for extending PickleDB lists and adding more items to them

Implementations

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"]);

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

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 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.