Struct brane_cli::instance::InstanceInfo

source ·
pub struct InstanceInfo {
    pub api: Address,
    pub drv: Address,
    pub user: String,
}
Expand description

Defines the layout of an InstanceInfo, which describes what we remember about each instance.

Note that the name is encoded as the file’s name.

Fields§

§api: Address

The place where we can find the API service for this instance.

§drv: Address

The place where we can find the driver service for this instance.

§user: String

A username to send with workflow requests as receiver of the final result.

Implementations§

source§

impl InstanceInfo

source

pub fn from_active_path() -> Result<Self, Error>

Reads this InstanceInfo from the active instance’s directory in the local configuration directory.

§Returns

A new InstanceInfo instance that is populated with the contents of the file pointed to by the active-instance symlink.

§Errors

This function errors if we failed to get the local path, there is no active instance, if we failed to read the file or if we failed to parse it.

source

pub fn active_instance_exists() -> Result<bool, Error>

Asserts whether there is a selected instance or nay.

§Returns

true if there is an active instance link, or false otherwise.

§Errors

This function errors if we failed to get the default link path.

source

pub fn from_default_path(name: impl AsRef<str>) -> Result<Self, Error>

Reads this InstanceInfo from the default path in the local configuration directory.

§Arguments
  • name: The name for this instance. Will cause errors if it contains characters incompatible for paths of OS.
§Returns

A new InstanceInfo instance that is populated with the contents of the file.

§Errors

This function errors if we failed to get the local path, if we failed to read the file or if we failed to parse it.

source

pub fn from_path(path: impl AsRef<Path>) -> Result<Self, Error>

Reads this InstanceInfo from the given path.

§Arguments
  • path: The path to read it from.
§Returns

A new InstanceInfo instance that is populated with the contents of the file.

§Errors

This function errors if we failed to read the file or if we failed to parse it.

source

pub fn get_active_name() -> Result<String, Error>

Computes the name of the active instance and returns it.

§Returns

The name of the instance currently set active.

§Errors

This function errors if we failed to get the active instance or read the file.

source

pub fn get_active_path() -> Result<PathBuf, Error>

Computes the active path and returns it.

This is not the path of the active instance link itself, but rather the instance it points to.

§Returns

The path to the active instance.

§Errors

This function errors if we failed to get the local path, or there is no active instance.

source

pub fn get_instance_path(name: impl AsRef<str>) -> Result<PathBuf, Error>

Computes the path to the directory of the instance with the given name.

§Arguments
  • name: The name of the instance to get the directory of.
§Returns

The path to this instance’s directory.

§Errors

This function may error if we failed to get the base config directory, or no such instance exists.

Trait Implementations§

source§

impl Clone for InstanceInfo

source§

fn clone(&self) -> InstanceInfo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for InstanceInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for InstanceInfo

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for InstanceInfo

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T