pub struct State { /* private fields */ }Expand description
State holds information about the runtime state of the container.
Implementations§
Source§impl State
impl State
Source§impl State
impl State
Sourcepub fn version_mut(&mut self) -> &mut String
pub fn version_mut(&mut self) -> &mut String
version is the version of the specification that is supported.
Sourcepub fn status_mut(&mut self) -> &mut ContainerState
pub fn status_mut(&mut self) -> &mut ContainerState
status is the runtime status of the container.
Sourcepub fn bundle_mut(&mut self) -> &mut PathBuf
pub fn bundle_mut(&mut self) -> &mut PathBuf
bundle is the path to the container’s bundle directory.
Source§impl State
impl State
Sourcepub fn set_version(&mut self, val: String) -> &mut Self
pub fn set_version(&mut self, val: String) -> &mut Self
version is the version of the specification that is supported.
Sourcepub fn set_status(&mut self, val: ContainerState) -> &mut Self
pub fn set_status(&mut self, val: ContainerState) -> &mut Self
status is the runtime status of the container.
Sourcepub fn set_pid(&mut self, val: Option<i32>) -> &mut Self
pub fn set_pid(&mut self, val: Option<i32>) -> &mut Self
pid is the process ID for the container process.
Sourcepub fn set_bundle(&mut self, val: PathBuf) -> &mut Self
pub fn set_bundle(&mut self, val: PathBuf) -> &mut Self
bundle is the path to the container’s bundle directory.
Source§impl State
impl State
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self, OciSpecError>
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, OciSpecError>
Load a State from the provided JSON file path.
§Errors
This function will return an OciSpecError::Io if the file does not exist or an OciSpecError::SerDe if the JSON is invalid.
Sourcepub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), OciSpecError>
pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), OciSpecError>
Save a State to the provided JSON file path.
§Errors
This function will return an OciSpecError::Io if a file cannot be created at the provided path or an OciSpecError::SerDe if the state cannot be serialized.