Struct k8s_openapi::apimachinery::pkg::runtime::RawExtension [−][src]
pub struct RawExtension(pub Value);
Expand description
RawExtension is used to hold extensions in external versions.
To use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.
// Internal package: type MyAPIObject struct {
runtime.TypeMeta json:",inline"
MyPlugin runtime.Object json:"myPlugin"
} type PluginA struct {
AOption string json:"aOption"
}
// External package: type MyAPIObject struct {
runtime.TypeMeta json:",inline"
MyPlugin runtime.RawExtension json:"myPlugin"
} type PluginA struct {
AOption string json:"aOption"
}
// On the wire, the JSON will look something like this: { “kind”:“MyAPIObject”, “apiVersion”:“v1”, “myPlugin”: { “kind”:“PluginA”, “aOption”:“foo”, }, }
So what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package’s DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)
Trait Implementations
impl Clone for RawExtension
[src]
impl Clone for RawExtension
[src]fn clone(&self) -> RawExtension
[src]
fn clone(&self) -> RawExtension
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for RawExtension
[src]
impl Debug for RawExtension
[src]impl Default for RawExtension
[src]
impl Default for RawExtension
[src]fn default() -> RawExtension
[src]
fn default() -> RawExtension
[src]Returns the “default value” for a type. Read more
impl<'de> Deserialize<'de> for RawExtension
[src]
impl<'de> Deserialize<'de> for RawExtension
[src]fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl PartialEq<RawExtension> for RawExtension
[src]
impl PartialEq<RawExtension> for RawExtension
[src]fn eq(&self, other: &RawExtension) -> bool
[src]
fn eq(&self, other: &RawExtension) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &RawExtension) -> bool
[src]
fn ne(&self, other: &RawExtension) -> bool
[src]This method tests for !=
.
impl Serialize for RawExtension
[src]
impl Serialize for RawExtension
[src]impl StructuralPartialEq for RawExtension
[src]
Auto Trait Implementations
impl RefUnwindSafe for RawExtension
impl Send for RawExtension
impl Sync for RawExtension
impl Unpin for RawExtension
impl UnwindSafe for RawExtension
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<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
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,