pub struct Context {
pub name: String,
pub cluster: String,
pub namespace: Option<String>,
pub user: String,
}
Expand description
A context represents a mapping between known users in the users
set and
servers in the clusters
set. By looking them up here
Note: The context struct is flattened when compared to its representation in
the yaml file. There is no context
mapping, the values of the context
mapping are directly accessible on the Context
struct.
Fields
name: String
The name given to this context by the user
cluster: String
The cluster name
this context refers to
namespace: Option<String>
The default namespace to use with this context
user: String
The user name
this cluster refers to
Implementations
sourceimpl Context
impl Context
sourcepub fn get_cluster(&self, config: &Config) -> Option<Cluster>
pub fn get_cluster(&self, config: &Config) -> Option<Cluster>
Gets the Cluster
object associated with this context if it exists in
the provided config object.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Context
impl<'de> Deserialize<'de> for Context
sourcefn deserialize<D>(d: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more