pub struct ObjectList<T> where
    T: Clone
{ pub metadata: ListMeta, pub items: Vec<T>, }
Expand description

A generic Kubernetes object list

This is used instead of a full struct for DeploymentList, PodList, etc. Kubernetes’ API always seem to expose list structs in this manner.

Note that this is only used internally within reflectors and informers, and is generally produced from list/watch/delete collection queries on an Resource.

This is almost equivalent to k8s_openapi::List<T>, but iterable.

Fields

metadata: ListMeta

ListMeta - only really used for its resourceVersion

See ListMeta

items: Vec<T>

The items we are actually interested in. In practice; T := Resource<T,U>.

Implementations

iter returns an Iterator over the elements of this ObjectList

Example
use kube::api::{ListMeta, ObjectList};

let metadata: ListMeta = Default::default();
let items = vec![1, 2, 3];
let objectlist = ObjectList { metadata, items };

let first = objectlist.iter().next();
println!("First element: {:?}", first); // prints "First element: Some(1)"

iter_mut returns an Iterator of mutable references to the elements of this ObjectList

Example
use kube::api::{ObjectList, ListMeta};

let metadata: ListMeta = Default::default();
let items = vec![1, 2, 3];
let mut objectlist = ObjectList { metadata, items };

let mut first = objectlist.iter_mut().next();

// Reassign the value in first
if let Some(elem) = first {
    *elem = 2;
    println!("First element: {:?}", elem); // prints "First element: 2"
}

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Which kind of iterator are we turning this into?

The type of the elements being iterated over.

Creates an iterator from a value. Read more

Which kind of iterator are we turning this into?

The type of the elements being iterated over.

Creates an iterator from a value. Read more

Which kind of iterator are we turning this into?

The type of the elements being iterated over.

Creates an iterator from a value. Read more

Serialize this value into the given Serde serializer. Read more

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

Performs the conversion.

Performs the conversion.

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.