Struct kube_runtime::reflector::ObjectRef [−][src]
pub struct ObjectRef<K: Resource> { pub name: String, pub namespace: Option<String>, // some fields omitted }
Expand description
A typed and namedspaced (if relevant) reference to a Kubernetes object
K
may be either the object type or DynamicObject
, in which case the
type is stored at runtime. Erased ObjectRef
s pointing to different types
are still considered different.
use kube_runtime::reflector::ObjectRef; use k8s_openapi::api::core::v1::{ConfigMap, Secret}; assert_ne!( ObjectRef::<ConfigMap>::new("a").erase(), ObjectRef::<Secret>::new("a").erase(), );
Fields
name: String
Expand description
The name of the object
namespace: Option<String>
Expand description
The namespace of the object
May only be None
if the kind is cluster-scoped (not located in a namespace).
Note that it is acceptable for an ObjectRef
to a cluster-scoped resource to
have a namespace. These are, however, not considered equal:
assert_ne!(ObjectRef::<ConfigMap>::new("foo"), ObjectRef::new("foo").within("bar"));
Implementations
impl<K: Resource> ObjectRef<K>
[src]
impl<K: Resource> ObjectRef<K>
[src]#[must_use]pub fn new_with(name: &str, dyntype: K::DynamicType) -> Self
[src]
#[must_use]pub fn within(self, namespace: &str) -> Self
[src]
#[must_use]pub fn from_obj_with(obj: &K, dyntype: K::DynamicType) -> Self where
K: Resource,
[src]
#[must_use]pub fn from_obj_with(obj: &K, dyntype: K::DynamicType) -> Self where
K: Resource,
[src]Creates ObjectRef
from the resource and dynamic type.
Panics if name is missing (name always exists if the object
was returned from the apiserver)
#[must_use]pub fn from_owner_ref(
namespace: Option<&str>,
owner: &OwnerReference,
dyntype: K::DynamicType
) -> Option<Self>
[src]
#[must_use]pub fn from_owner_ref(
namespace: Option<&str>,
owner: &OwnerReference,
dyntype: K::DynamicType
) -> Option<Self>
[src]Create an ObjectRef
from an OwnerReference
Returns None
if the types do not match.
#[must_use]pub fn into_kind_unchecked<K2: Resource>(
self,
dt2: K2::DynamicType
) -> ObjectRef<K2>
[src]
#[must_use]pub fn into_kind_unchecked<K2: Resource>(
self,
dt2: K2::DynamicType
) -> ObjectRef<K2>
[src]Convert into a reference to K2
Note that no checking is done on whether this conversion makes sense. For example, every Service
has a corresponding Endpoints
, but it wouldn’t make sense to convert a Pod
into a Deployment
.
pub fn erase(self) -> ObjectRef<DynamicObject>
[src]
Trait Implementations
impl<K: Resource> Eq for ObjectRef<K> where
K::DynamicType: Eq,
[src]
K::DynamicType: Eq,
Auto Trait Implementations
impl<K> RefUnwindSafe for ObjectRef<K> where
<K as Resource>::DynamicType: RefUnwindSafe,
<K as Resource>::DynamicType: RefUnwindSafe,
impl<K> Send for ObjectRef<K>
impl<K> Sync for ObjectRef<K>
impl<K> Unpin for ObjectRef<K> where
<K as Resource>::DynamicType: Unpin,
<K as Resource>::DynamicType: Unpin,
impl<K> UnwindSafe for ObjectRef<K> where
<K as Resource>::DynamicType: UnwindSafe,
<K as Resource>::DynamicType: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more