Skip to main content

Builder

Struct Builder 

Source
pub struct Builder { /* private fields */ }
Expand description

Сборка инстанса: читает конфигурацию, ставит журнал, создаёт модули в порядке объявления и связывает их.

Связи передаются значениями: модуль объявляет их типом Module::Args, а сборка передаёт их аргументом. Модуль нельзя добавить раньше его поставщика — порядок запуска задан сборкой, остановка идёт в обратном порядке.

Implementations§

Source§

impl Builder

Source

pub fn new(source: &Source, service: Service) -> Result<Self, Error>

Сборка службы service с конфигурацией платформы из источника source.

Журнал ставится здесь же, чтобы сообщения сборки не терялись.

Source

pub async fn add<M: Module>(&mut self, args: M::Args) -> Result<Link<M>, Error>

Добавить модуль. Секции конфигурации нет — действуют умолчания. Возвращает ссылку для зависимых модулей. Модуль с повторившимся именем — ошибка.

Source

pub async fn optional<M: Module>( &mut self, args: M::Args, ) -> Result<Link<M>, Error>

Добавить модуль, который включён, только когда его секция конфигурации задана. Без секции или с обнулённой секцией модуль не регистрируется, а ссылка на него остаётся пустой. Модуль без настроек NoSettings включён всегда.

Source

pub fn build(self) -> Instance

Завершить сборку.

Auto Trait Implementations§

§

impl !Freeze for Builder

§

impl !RefUnwindSafe for Builder

§

impl !UnwindSafe for Builder

§

impl Forget for Builder

§

impl Move for Builder

§

impl Send for Builder
where RawVecInner: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, Arc<Registry>: Send, Arc<InstrumentState<Family<Labels, Counter>>>: Send, Arc<InstrumentState<Family<Labels, Gauge<f64, Atomic<u64>>>>>: Send, Arc<InstrumentState<Family<Labels, Histogram, HistogramConstructor>>>: Send, Mutex<[u64; 6]>: Send, NodeRef<Owned, String, Vec<f64>, LeafOrInternal>: Send, BoxRaw<(String, Vec<f64>)>: Send, Arc<Shared>: Send, Arc<State>: Send, &'static str: Send, Arc<dyn Runtime>: Send, Arc<Inner>: Send, Arc<TreeNode>: Send, JoinHandle<()>: Send, Arc<Shared<DependencyInfo>>: Send, Arc<Shared<Option<Stop>>>: Send, Arc<Mutex<Inner>>: Send, Arc<ClientFactory>: Send,

§

impl Sync for Builder
where RawVecInner: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, Arc<Registry>: Sync, Arc<InstrumentState<Family<Labels, Counter>>>: Sync, Arc<InstrumentState<Family<Labels, Gauge<f64, Atomic<u64>>>>>: Sync, Arc<InstrumentState<Family<Labels, Histogram, HistogramConstructor>>>: Sync, Mutex<[u64; 6]>: Sync, NodeRef<Owned, String, Vec<f64>, LeafOrInternal>: Sync, BoxRaw<(String, Vec<f64>)>: Sync, Arc<Shared>: Sync, Arc<State>: Sync, Arc<dyn Runtime>: Sync, Arc<Inner>: Sync, Arc<TreeNode>: Sync, JoinHandle<()>: Sync, Arc<Shared<DependencyInfo>>: Sync, Arc<Shared<Option<Stop>>>: Sync, Arc<Mutex<Inner>>: Sync, Arc<ClientFactory>: Sync,

§

impl Unpin for Builder
where *const u8 is !null: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, Arc<Registry>: Unpin, Arc<InstrumentState<Family<Labels, Counter>>>: Unpin, Arc<InstrumentState<Family<Labels, Gauge<f64, Atomic<u64>>>>>: Unpin, Arc<InstrumentState<Family<Labels, Histogram, HistogramConstructor>>>: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin, *const LeafNode<String, Vec<f64>> is !null: Unpin, Box<(String, Vec<f64>)>: Unpin, Arc<Shared>: Unpin, Arc<State>: Unpin, &'static str: Unpin, Arc<dyn Runtime>: Unpin, Arc<Inner>: Unpin, Arc<TreeNode>: Unpin, JoinHandle<()>: Unpin, Arc<Shared<DependencyInfo>>: Unpin, Arc<Shared<Option<Stop>>>: Unpin, Arc<Mutex<Inner>>: Unpin, Arc<ClientFactory>: Unpin,

§

impl UnsafeUnpin for Builder
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const LeafNode<String, String> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, String)>>: UnsafeUnpin, *const ArcInner<Registry> is !null: UnsafeUnpin, PhantomData<ArcInner<Registry>>: UnsafeUnpin, *const ArcInner<InstrumentState<Family<Labels, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<InstrumentState<Family<Labels, Counter>>>>: UnsafeUnpin, PhantomData<(String, String)>: UnsafeUnpin, *const ArcInner<InstrumentState<Family<Labels, Gauge<f64, Atomic<u64>>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<InstrumentState<Family<Labels, Gauge<f64, Atomic<u64>>>>>>: UnsafeUnpin, *const ArcInner<InstrumentState<Family<Labels, Histogram, HistogramConstructor>>> is !null: UnsafeUnpin, PhantomData<ArcInner<InstrumentState<Family<Labels, Histogram, HistogramConstructor>>>>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, PhantomData<f64>: UnsafeUnpin, PhantomData<u64>: UnsafeUnpin, *const LeafNode<String, Vec<f64>> is !null: UnsafeUnpin, PhantomData<Box<(String, Vec<f64>)>>: UnsafeUnpin, *const ArcInner<Shared> is !null: UnsafeUnpin, PhantomData<ArcInner<Shared>>: UnsafeUnpin, *const ArcInner<State> is !null: UnsafeUnpin, PhantomData<ArcInner<State>>: UnsafeUnpin, PhantomData<Entry>: UnsafeUnpin, PhantomData<Dependencies>: UnsafeUnpin, PhantomData<ConfigRecord>: UnsafeUnpin, *const ArcInner<TreeNode> is !null: UnsafeUnpin, PhantomData<ArcInner<TreeNode>>: UnsafeUnpin, *const ArcInner<Shared<Option<Stop>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Shared<Option<Stop>>>>: UnsafeUnpin, *const ArcInner<Mutex<Inner>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<Inner>>>: UnsafeUnpin, *const ArcInner<ClientFactory> is !null: UnsafeUnpin, PhantomData<ArcInner<ClientFactory>>: UnsafeUnpin,

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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