Struct kube::api::ObjectList [−][src]
client
only.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
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
impl<'de, T> Deserialize<'de> for ObjectList<T> where
T: Clone,
Vec<T, Global>: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ObjectList<T> where
T: Clone,
Vec<T, Global>: Deserialize<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<ObjectList<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<ObjectList<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Creates an iterator from a value. Read more
Creates an iterator from a value. Read more
type IntoIter = IntoIter<<ObjectList<T> as IntoIterator>::Item, Global>
type IntoIter = IntoIter<<ObjectList<T> as IntoIterator>::Item, Global>
Which kind of iterator are we turning this into?
type Item = T
type Item = T
The type of the elements being iterated over.
Creates an iterator from a value. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for ObjectList<T> where
T: RefUnwindSafe,
impl<T> Send for ObjectList<T> where
T: Send,
impl<T> Sync for ObjectList<T> where
T: Sync,
impl<T> Unpin for ObjectList<T> where
T: Unpin,
impl<T> UnwindSafe for ObjectList<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
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