Struct kube_client::api::ObjectList
source · [−]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: ListMetaListMeta - 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
sourceimpl<T> ObjectList<T> where
T: Clone,
impl<T> ObjectList<T> where
T: Clone,
sourcepub fn iter(&'a self) -> impl Iterator<Item = &'a T> + 'a
pub fn iter(&'a self) -> impl Iterator<Item = &'a T> + 'a
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)"sourcepub fn iter_mut(&'a mut self) -> impl Iterator<Item = &'a mut T> + 'a
pub fn iter_mut(&'a mut self) -> impl Iterator<Item = &'a mut T> + 'a
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
sourceimpl<T> Debug for ObjectList<T> where
T: Debug + Clone,
impl<T> Debug for ObjectList<T> where
T: Debug + Clone,
sourceimpl<'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>,
sourcepub 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
sourceimpl<'a, T> IntoIterator for &'a ObjectList<T> where
T: Clone,
impl<'a, T> IntoIterator for &'a ObjectList<T> where
T: Clone,
sourcepub fn into_iter(self) -> <&'a ObjectList<T> as IntoIterator>::IntoIter
pub fn into_iter(self) -> <&'a ObjectList<T> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<T> IntoIterator for ObjectList<T> where
T: Clone,
impl<T> IntoIterator for ObjectList<T> where
T: Clone,
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.
sourcepub fn into_iter(self) -> <ObjectList<T> as IntoIterator>::IntoIter
pub fn into_iter(self) -> <ObjectList<T> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<'a, T> IntoIterator for &'a mut ObjectList<T> where
T: Clone,
impl<'a, T> IntoIterator for &'a mut ObjectList<T> where
T: Clone,
sourcepub fn into_iter(self) -> <&'a mut ObjectList<T> as IntoIterator>::IntoIter
pub fn into_iter(self) -> <&'a mut ObjectList<T> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<T> Serialize for ObjectList<T> where
T: Clone + Serialize,
impl<T> Serialize for ObjectList<T> where
T: Clone + Serialize,
sourcepub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more