pub struct ObjectList<T>where
    T: Clone,
{ pub metadata: ListMeta, pub items: Vec<T, Global>, }
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, Global>

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

Implementations

Available on crate feature client only.

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)"
Available on crate feature client only.

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

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more