Skip to main content

AlorHttpClient

Struct AlorHttpClient 

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

The authorized HTTP client of the ALOR OpenAPI.

It holds the refresh token and the current access token and adds Authorization: Bearer ... to every call:

  • The first call trades the refresh token for an access token (POST /refresh of the authorization server). The access token is cached for 20 minutes (or less, if its own expiry is nearer).
  • When the broker answers 401 to a read, the client gets a new access token and repeats the same request once.
  • A command (placing, changing or cancelling an order) is never repeated, not even after a 401: the client renews the token for the next call and returns the 401 as an error.
  • A transport error or a timeout is never repeated.

The client is cheap to clone. Clones share the tokens and the connection pool. The endpoint methods (one per REST call) are documented on this type too, they are in super::endpoints. The broker limits HTTP calls to 100 a second per user; the client does not throttle, the connector does it through the shared limiter.

§Examples

use brokapi_alor_protocol::http::client::AlorHttpClient;

let client = AlorHttpClient::new(cfg)?;
let book = client.get_order_book("MOEX", "SBER", Some("TQBR"), Some(5)).await?;
println!("{} levels of bids", book.bids.len());

Implementations§

Source§

impl AlorHttpClient

Source

pub fn new(config: AlorConfig) -> Result<Self, AlorApiError>

Creates a client from a configuration. No network call is made.

§Errors

AlorApiError::Http (no status) if the HTTP stack cannot be built.

§Examples
use brokapi_alor_protocol::config::AlorConfig;
use brokapi_alor_protocol::http::client::AlorHttpClient;

let client = AlorHttpClient::new(AlorConfig::new("refresh-token".to_string()))?;
assert_eq!(client.base_url(), "https://api.alor.ru");
Source

pub async fn get_access_token(&self) -> Result<String, AlorApiError>

The access token now: the cached one, or a new one if there is none or it is past its time.

The WebSocket session calls this before every message that needs a token.

§Errors

As AlorHttpClient::refresh_access_token, and only when a new token is needed.

§Examples
use brokapi_alor_protocol::http::client::AlorHttpClient;

let client = AlorHttpClient::new(cfg)?;
let first = client.get_access_token().await?;
let second = client.get_access_token().await?; // from the cache, no second token request
assert_eq!(first, second);
Source

pub async fn refresh_access_token(&self) -> Result<String, AlorApiError>

Trades the refresh token for a new access token and stores it. Always calls the authorization server.

Sends POST /refresh with the refresh token in a JSON body (not in the URL, so it stays out of logs). The new access token is cached. Refreshes are serialised by a lock.

§Errors
Source

pub async fn token_portfolios(&self) -> Result<Vec<String>, AlorApiError>

The portfolios named in the claims of the current access token (the portfolios claim of the JWT).

The connector uses it to find the portfolio when the config names none. Empty when the token is not a JWT or carries no portfolios.

§Errors

As AlorHttpClient::get_access_token.

Source

pub async fn read<T: DeserializeOwned>( &self, path: &str, query: &[(&str, String)], ) -> Result<T, AlorApiError>

GETs a path with query parameters and parses the JSON reply into T.

path starts with / and is added to the base URL. A 401 is answered with one token refresh and one repeat. Other failures are not retried. The typed methods of super::endpoints call it.

§Errors
§Examples
use brokapi_alor_protocol::error::AlorApiError;
use brokapi_alor_protocol::http::client::AlorHttpClient;

let client = AlorHttpClient::new(cfg)?;
let time: serde_json::Value = client.read("/md/v2/time", &[]).await?;
assert!(time.is_number());

// A path the broker does not know ends in an error that carries the status.
let err = client.read::<serde_json::Value>("/no/such/path", &[]).await.unwrap_err();
assert!(matches!(err, AlorApiError::NotFound { .. }));
Source

pub async fn command<T, B>( &self, method: Method, path: &str, query: &[(&str, String)], body: Option<&B>, req_id: Option<&str>, ) -> Result<T, AlorApiError>

Sends a command (place, change or cancel an order) and parses the JSON reply into T. Never repeats the request.

A repeat of a command is the one way to place an order twice, so the client sends it once. If the broker answers 401, the client renews the access token (so the next call works) and returns the 401 as AlorApiError::Http with status: Some(401); a 401 means the broker did not act. A transport error or a timeout is an unknown outcome, as for every command. req_id becomes the header X-REQID: the broker answers a repeated id with a copy of its first answer instead of doing the command again.

§Errors

The same as AlorHttpClient::read.

Source

pub async fn read_raw( &self, path: &str, query: &[(&str, String)], ) -> Result<(StatusCode, String), AlorApiError>

GETs a path and returns the status and the body text, without parsing and without mapping errors.

An error status is not an Err here: you get it as the first element of the pair. Only a 401 is handled (one refresh, one repeat).

§Errors

AlorApiError::Http (no status) on a transport failure, and the errors of AlorHttpClient::refresh_access_token when a 401 needs a new token.

Source

pub fn inner_client(&self) -> &Client

The underlying reqwest client, for calls this crate does not wrap. It carries no authorization: add the token yourself with AlorHttpClient::get_access_token.

Source

pub fn base_url(&self) -> &str

The REST base URL this client calls, without a trailing slash.

Source

pub fn ws_base_url(&self) -> &str

The WebSocket base URL that sessions started from this client connect to.

Source§

impl AlorHttpClient

Source

pub async fn get_securities( &self, query: &[(&str, String)], ) -> Result<Vec<SecurityInfo>, AlorApiError>

GET /md/v2/Securities: a search over the instruments of all markets. query takes query (a ticker part), limit, offset, sector (FORTS, FOND, CURR), cficode, exchange, instrumentGroup and includeNonBaseBoards.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_securities_by_exchange( &self, exchange: &str, query: &[(&str, String)], ) -> Result<Vec<SecurityInfo>, AlorApiError>

GET /md/v2/Securities/{exchange}: the instruments of one exchange. query is as in AlorHttpClient::get_securities (limit, offset, sector, …).

§Errors

As AlorHttpClient::read.

Source

pub async fn get_security( &self, exchange: &str, symbol: &str, group: Option<&str>, ) -> Result<SecurityInfo, AlorApiError>

GET /md/v2/Securities/{exchange}/{symbol}: one instrument, in the trading mode group (the main one if left out).

§Errors

As AlorHttpClient::read; AlorApiError::NotFound for an unknown instrument.

§Examples
use brokapi_alor_protocol::http::client::AlorHttpClient;

let client = AlorHttpClient::new(cfg)?;
let sber = client.get_security("MOEX", "SBER", Some("TQBR")).await?;
assert_eq!(sber.symbol, "SBER");
assert!(sber.lot_size.is_some());
Source

pub async fn get_available_boards( &self, exchange: &str, symbol: &str, ) -> Result<Value, AlorApiError>

GET /md/v2/Securities/{exchange}/{symbol}/availableBoards: the trading modes the instrument trades in.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_quotes( &self, symbols: &[(&str, &str)], ) -> Result<Vec<QuoteRecord>, AlorApiError>

GET /md/v2/Securities/{symbols}/quotes: the quotations of several instruments. symbols are pairs of exchange and ticker.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_currency_pairs(&self) -> Result<Value, AlorApiError>

GET /md/v2/Securities/currencyPairs: the currency pairs.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_actual_futures_quote( &self, exchange: &str, symbol: &str, ) -> Result<Value, AlorApiError>

GET /md/v2/Securities/{exchange}/{symbol}/actualFuturesQuote: the quotation of the nearest futures of an underlying.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_risk_rates( &self, query: &[(&str, String)], ) -> Result<Value, AlorApiError>

GET /md/v2/risk/rates: the risk rates of instruments. query takes exchange, ticker, riskCategoryId, search, limit, offset, …

§Errors

As AlorHttpClient::read.

Source

pub async fn get_time(&self) -> Result<i64, AlorApiError>

GET /md/v2/time: the server time, Unix seconds. The broker asks for it rarely (the time is not exact).

§Errors

As AlorHttpClient::read.

Source

pub async fn get_market_status( &self, exchange: &str, market: &str, ) -> Result<MarketStatus, AlorApiError>

GET /md/status/{exchange}/{market}: the state of the trading session of a market (FORTS, FOND, CURR, SPBX).

§Errors

As AlorHttpClient::read.

Source§

impl AlorHttpClient

Source

pub async fn get_order_book( &self, exchange: &str, symbol: &str, group: Option<&str>, depth: Option<u32>, ) -> Result<OrderBook, AlorApiError>

GET /md/v2/orderbooks/{exchange}/{symbol}: the order book. depth is 20 by default and 50 at most.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_history( &self, exchange: &str, symbol: &str, group: Option<&str>, tf: &str, from: i64, to: i64, count_back: Option<u32>, ) -> Result<HistoryResponse, AlorApiError>

GET /md/v2/history: candles. tf is a number of seconds (60, 3600) or D, W, M, Y; from and to are Unix seconds; count_back asks for at least that many candles.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_all_trades( &self, exchange: &str, symbol: &str, group: Option<&str>, query: &[(&str, String)], ) -> Result<Vec<MarketTradeRecord>, AlorApiError>

GET /md/v2/Securities/{exchange}/{symbol}/alltrades: the trades of the market of today. query takes from, to (Unix seconds), fromId, toId, qtyFrom, qtyTo, priceFrom, priceTo, side, offset, take, descending, includeVirtualTrades.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_all_trades_history( &self, exchange: &str, symbol: &str, group: Option<&str>, query: &[(&str, String)], ) -> Result<AllTradesHistory, AlorApiError>

GET /md/v2/Securities/{exchange}/{symbol}/alltrades/history: the trades of the market of the past days, a page at a time. query takes from, to (Unix seconds), limit (required by the broker, 1 to 50000) and offset.

§Errors

As AlorHttpClient::read.

Source§

impl AlorHttpClient

Source

pub async fn get_orders( &self, exchange: &str, portfolio: &str, ) -> Result<Vec<OrderRecord>, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/orders: all orders of the portfolio of today.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_order( &self, exchange: &str, portfolio: &str, order_id: &str, ) -> Result<OrderRecord, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/orders/{orderId}: one order. AlorApiError::NotFound when the broker does not know the number.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_stop_orders( &self, exchange: &str, portfolio: &str, ) -> Result<Vec<StopOrderRecord>, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/stoporders: all stop orders of the portfolio of today.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_stop_order( &self, exchange: &str, portfolio: &str, order_id: &str, ) -> Result<StopOrderRecord, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/stoporders/{orderId}: one stop order.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_money_legacy( &self, exchange: &str, portfolio: &str, ) -> Result<Value, AlorApiError>

GET /md/v2/Clients/legacy/{exchange}/{portfolio}/money: the money of the portfolio (the old form).

§Errors

As AlorHttpClient::read.

Source

pub async fn get_summary( &self, exchange: &str, portfolio: &str, ) -> Result<SummaryRecord, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/summary: the summary of the portfolio.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_positions( &self, exchange: &str, portfolio: &str, without_currency: bool, ) -> Result<Vec<PositionRecord>, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/positions: the positions, with the money as positions of currencies unless without_currency is set.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_position( &self, exchange: &str, portfolio: &str, symbol: &str, ) -> Result<PositionRecord, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/positions/{symbol}: the position in one instrument.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_login_positions( &self, login: &str, ) -> Result<Vec<PositionRecord>, AlorApiError>

GET /md/v2/Clients/{login}/positions: the positions of all portfolios of a trade login.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_trades( &self, exchange: &str, portfolio: &str, ) -> Result<Vec<TradeRecord>, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/trades: the trades of the portfolio of today.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_symbol_trades( &self, exchange: &str, portfolio: &str, symbol: &str, ) -> Result<Vec<TradeRecord>, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/{symbol}/trades: the trades of the portfolio in one instrument.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_forts_risk( &self, exchange: &str, portfolio: &str, ) -> Result<Value, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/fortsrisk: the risks of the futures market.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_risk( &self, exchange: &str, portfolio: &str, ) -> Result<Value, AlorApiError>

GET /md/v2/Clients/{exchange}/{portfolio}/risk: the risks of the portfolio.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_trade_stats( &self, exchange: &str, portfolio: &str, query: &[(&str, String)], ) -> Result<Value, AlorApiError>

GET /md/stats/{exchange}/{portfolio}/history/trades: the statistics of the trades (the old form). query takes dateFrom, ticker, id, limit, side, descending, …

§Errors

As AlorHttpClient::read.

Source

pub async fn get_trade_stats_by_symbol( &self, exchange: &str, portfolio: &str, symbol: &str, query: &[(&str, String)], ) -> Result<Value, AlorApiError>

GET /md/stats/{exchange}/{portfolio}/history/trades/{symbol}: the same for one instrument.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_history_trades( &self, exchange: &str, portfolio: &str, query: &[(&str, String)], ) -> Result<Vec<TradeRecord>, AlorApiError>

GET /md/v2/Stats/{exchange}/{portfolio}/history/trades: the trades of the portfolio of the past days, a page at a time. query takes dateFrom (a date or a date and time), from (the number of the first trade), limit (1 to 1000), ticker, side, orderByTradeDate, descending, withRepo.

§Errors

As AlorHttpClient::read.

Source

pub async fn get_history_trades_by_symbol( &self, exchange: &str, portfolio: &str, symbol: &str, query: &[(&str, String)], ) -> Result<Vec<TradeRecord>, AlorApiError>

GET /md/v2/Stats/{exchange}/{portfolio}/history/trades/{symbol}: the same for one instrument.

§Errors

As AlorHttpClient::read.

Source§

impl AlorHttpClient

Source

pub async fn create_limit_order( &self, req_id: &str, order: &LimitOrderRequest, ) -> Result<OrderCommandResponse, AlorApiError>

POST .../orders/actions/limit: a limit order. req_id is the header X-REQID: unique for the whole system; the broker answers a repeated id with a copy of its first answer and does not place a second order.

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn create_market_order( &self, req_id: &str, order: &MarketOrderRequest, ) -> Result<OrderCommandResponse, AlorApiError>

POST .../orders/actions/market: a market order. See AlorHttpClient::create_limit_order for req_id.

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn update_limit_order( &self, req_id: &str, order_id: &str, order: &LimitOrderRequest, ) -> Result<OrderCommandResponse, AlorApiError>

PUT .../orders/actions/limit/{orderId}: changes a limit order (the broker takes the new quantity and price and answers with the number of the order that replaced it).

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn update_market_order( &self, req_id: &str, order_id: &str, order: &MarketOrderRequest, ) -> Result<OrderCommandResponse, AlorApiError>

PUT .../orders/actions/market/{orderId}: changes a market order.

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn create_stop_order( &self, req_id: &str, order: &StopOrderRequest, ) -> Result<OrderCommandResponse, AlorApiError>

POST .../orders/actions/stop: a stop order that makes a market order on trigger.

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn create_stop_limit_order( &self, req_id: &str, order: &StopOrderRequest, ) -> Result<OrderCommandResponse, AlorApiError>

POST .../orders/actions/stopLimit: a stop order that makes a limit order on trigger (order.price).

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn update_stop_order( &self, req_id: &str, order_id: &str, order: &StopOrderRequest, ) -> Result<OrderCommandResponse, AlorApiError>

PUT .../orders/actions/stop/{stopOrderId}: changes a stop order.

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn update_stop_limit_order( &self, req_id: &str, order_id: &str, order: &StopOrderRequest, ) -> Result<OrderCommandResponse, AlorApiError>

PUT .../orders/actions/stopLimit/{stopOrderId}: changes a stop-limit order.

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn cancel_order( &self, exchange: &str, portfolio: &str, order_id: &str, stop: bool, ) -> Result<Value, AlorApiError>

DELETE .../orders/{orderId}: cancels an order, or a stop order when stop is set. The broker names the exchange and the portfolio in the query, not in the path.

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn cancel_all_orders( &self, exchange: &str, portfolio: &str, stop: Option<bool>, ) -> Result<Value, AlorApiError>

DELETE .../orders/all: cancels all orders of the portfolio on the exchange (the stop orders when stop is Some(true)).

§Errors

As AlorHttpClient::command. The call is never repeated.

Source

pub async fn estimate_order(&self, body: &Value) -> Result<Value, AlorApiError>

POST .../orders/estimate: estimates one order (the quantity the portfolio can buy or sell, the cost, the commission). The body is portfolio, ticker, exchange, price, lotQuantity or budget, board, includeLimitOrders.

§Errors

As AlorHttpClient::command. It changes nothing at the broker, but is not repeated either.

Source

pub async fn estimate_orders(&self, body: &Value) -> Result<Value, AlorApiError>

POST .../orders/estimate/all: estimates a list of orders. The body is a list of the bodies of AlorHttpClient::estimate_order.

§Errors

As AlorHttpClient::estimate_order.

Source§

impl AlorHttpClient

Source

pub async fn get_order_groups(&self) -> Result<Value, AlorApiError>

GET /commandapi/api/orderGroups: the order groups of the user.

§Errors

As AlorHttpClient::read.

Source

pub async fn create_order_group( &self, body: &Value, ) -> Result<Value, AlorApiError>

POST /commandapi/api/orderGroups: makes a group of orders (orders and executionPolicy), where the execution or cancel of one order triggers the others.

§Errors

As AlorHttpClient::command.

Source

pub async fn get_order_group( &self, group_id: &str, ) -> Result<Value, AlorApiError>

GET /commandapi/api/orderGroups/{orderGroupId}: one order group.

§Errors

As AlorHttpClient::read.

Source

pub async fn update_order_group( &self, group_id: &str, body: &Value, ) -> Result<Value, AlorApiError>

PUT /commandapi/api/orderGroups/{orderGroupId}: changes an order group.

§Errors

As AlorHttpClient::command.

Source

pub async fn delete_order_group( &self, group_id: &str, ) -> Result<Value, AlorApiError>

DELETE /commandapi/api/orderGroups/{orderGroupId}: removes an order group (the orders stay).

§Errors

As AlorHttpClient::command.

Source§

impl AlorHttpClient

Source

pub async fn create_stop_loss( &self, server: &str, req_id: &str, body: &Value, ) -> Result<OrderCommandResponse, AlorApiError>

POST /warptrans/{tradeServerCode}/v2/client/orders/actions/stopLoss: the old stop-loss order. The broker marks the whole family as outdated: use AlorHttpClient::create_stop_order.

§Errors

As AlorHttpClient::command.

Source

pub async fn create_stop_loss_limit( &self, server: &str, req_id: &str, body: &Value, ) -> Result<OrderCommandResponse, AlorApiError>

POST .../actions/stopLossLimit: the old stop-loss order with a limit price.

§Errors

As AlorHttpClient::command.

Source

pub async fn create_take_profit( &self, server: &str, req_id: &str, body: &Value, ) -> Result<OrderCommandResponse, AlorApiError>

POST .../actions/takeProfit: the old take-profit order.

§Errors

As AlorHttpClient::command.

Source

pub async fn create_take_profit_limit( &self, server: &str, req_id: &str, body: &Value, ) -> Result<OrderCommandResponse, AlorApiError>

POST .../actions/takeProfitLimit: the old take-profit order with a limit price.

§Errors

As AlorHttpClient::command.

Source

pub async fn update_stop_loss( &self, server: &str, req_id: &str, order_id: &str, body: &Value, ) -> Result<OrderCommandResponse, AlorApiError>

PUT .../actions/stopLoss/{orderId}: changes an old stop-loss order.

§Errors

As AlorHttpClient::command.

Source

pub async fn update_stop_loss_limit( &self, server: &str, req_id: &str, order_id: &str, body: &Value, ) -> Result<OrderCommandResponse, AlorApiError>

PUT .../actions/stopLossLimit/{orderId}: changes an old stop-loss order with a limit price.

§Errors

As AlorHttpClient::command.

Source

pub async fn update_take_profit( &self, server: &str, req_id: &str, order_id: &str, body: &Value, ) -> Result<OrderCommandResponse, AlorApiError>

PUT .../actions/takeProfit/{orderId}: changes an old take-profit order.

§Errors

As AlorHttpClient::command.

Source

pub async fn update_take_profit_limit( &self, server: &str, req_id: &str, order_id: &str, body: &Value, ) -> Result<OrderCommandResponse, AlorApiError>

PUT .../actions/takeProfitLimit/{orderId}: changes an old take-profit order with a limit price.

§Errors

As AlorHttpClient::command.

Source

pub async fn cancel_order_legacy( &self, server: &str, order_id: &str, query: &[(&str, String)], ) -> Result<Value, AlorApiError>

DELETE /warptrans/{tradeServerCode}/v2/client/orders/{orderId}: cancels an order by the old path.

§Errors

As AlorHttpClient::command.

Trait Implementations§

Source§

impl Clone for AlorHttpClient

Source§

fn clone(&self) -> AlorHttpClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. 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<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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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