pub struct Microgrid { /* private fields */ }Expand description
A high-level interface for the Microgrid API.
Implementations§
Source§impl Microgrid
impl Microgrid
Sourcepub async fn try_new(
url: impl Into<String>,
config: LogicalMeterConfig,
) -> Result<Self, Error>
pub async fn try_new( url: impl Into<String>, config: LogicalMeterConfig, ) -> Result<Self, Error>
Creates a new Microgrid instance with the given microgrid API URL and
logical meter configuration.
The microgrid API connection is established lazily and connection or component-graph build errors during setup are retried indefinitely, so this call blocks until the server is reachable and returns valid data. Returns an error only if the URL is malformed or if the provided logical meter configuration is invalid.
Sourcepub fn new_from_handles(
client: MicrogridClientHandle,
logical_meter: LogicalMeterHandle,
) -> Self
pub fn new_from_handles( client: MicrogridClientHandle, logical_meter: LogicalMeterHandle, ) -> Self
Creates a new Microgrid instance from the given client and logical
meter handles.
Sourcepub fn client(&self) -> MicrogridClientHandle
pub fn client(&self) -> MicrogridClientHandle
Returns a handle to the Microgrid client.
Sourcepub fn logical_meter(&self) -> LogicalMeterHandle
pub fn logical_meter(&self) -> LogicalMeterHandle
Returns a handle to the logical meter.
pub fn battery_pool( &self, component_ids: Option<Vec<u64>>, ) -> Result<BatteryPool, Error>
Auto Trait Implementations§
impl Freeze for Microgrid
impl RefUnwindSafe for Microgrid
impl Send for Microgrid
impl Sync for Microgrid
impl Unpin for Microgrid
impl UnsafeUnpin for Microgrid
impl UnwindSafe for Microgrid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request