pub struct BuildContext { /* private fields */ }Expand description
Build-time component context.
Carries information about the component being built, as well as access to the resource registry in order to acquire external resources if necessary.
Implementations§
Source§impl BuildContext
impl BuildContext
Sourcepub fn new(
component_context: ComponentContext,
resource_registry: ResourceRegistry,
) -> Self
pub fn new( component_context: ComponentContext, resource_registry: ResourceRegistry, ) -> Self
Creates a new BuildContext for the given component.
Sourcepub fn component_context(&self) -> &ComponentContext
pub fn component_context(&self) -> &ComponentContext
Returns the context of the component being built.
Sourcepub fn component_id(&self) -> &ComponentId
pub fn component_id(&self) -> &ComponentId
Returns the component identifier.
This is the relative identifier of the component, unique within its topology but not guaranteed to be globally
unique. See BuildContext::identity for the fully qualified identity.
Sourcepub fn component_type(&self) -> ComponentType
pub fn component_type(&self) -> ComponentType
Returns the component type.
Sourcepub fn identity(&self) -> SubsystemIdentifier
pub fn identity(&self) -> SubsystemIdentifier
Returns the fully qualified identity of this component.
The returned identifier uniquely identifies the component within the process, inclusive of the topology to which it belongs.
Sourcepub async fn acquire_resource<S: ResourceSpecification>(
&self,
spec: S,
) -> Result<ResourceLease<S::Resource>, AcquireError>
pub async fn acquire_resource<S: ResourceSpecification>( &self, spec: S, ) -> Result<ResourceLease<S::Resource>, AcquireError>
Acquires a resource on behalf of the component being built.
§Errors
If the resource is already held elsewhere in the process, or can’t be created, an error is returned.
Trait Implementations§
Source§impl Clone for BuildContext
impl Clone for BuildContext
Source§fn clone(&self) -> BuildContext
fn clone(&self) -> BuildContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BuildContext
impl RefUnwindSafe for BuildContext
impl Send for BuildContext
impl Sync for BuildContext
impl Unpin for BuildContext
impl UnwindSafe for BuildContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more