pub struct Client { /* private fields */ }Expand description
Client for Amazon Location Service Routes V2
Client for invoking operations on Amazon Location Service Routes V2. Each operation on Amazon Location Service Routes V2 is a method on this
this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.
§Constructing a Client
A Config is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env(), since this will resolve an SdkConfig which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env() instead, which returns a ConfigLoader that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_georoutes::Client::new(&config);Occasionally, SDKs may have additional service-specific values that can be set on the Config that
is absent from SdkConfig, or slightly different settings for a specific client may be desired.
The Builder struct implements From<&SdkConfig>, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_georoutes::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();See the aws-config docs and Config for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
§Using the Client
A client has a function for every operation that can be performed by the service.
For example, the CalculateIsolines operation has
a Client::calculate_isolines, function which returns a builder for that operation.
The fluent builder ultimately has a send() function that returns an async future that
returns a result, as illustrated below:
let result = client.calculate_isolines()
.arrival_time("example")
.send()
.await;The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize module for more
information.
Implementations§
Source§impl Client
impl Client
Sourcepub fn calculate_isolines(&self) -> CalculateIsolinesFluentBuilder
pub fn calculate_isolines(&self) -> CalculateIsolinesFluentBuilder
Constructs a fluent builder for the CalculateIsolines operation.
- The fluent builder is configurable:
allow(IsolineAllowOptions)/set_allow(Option<IsolineAllowOptions>):
required: falseFeatures that are allowed while calculating an isoline.
arrival_time(impl Into<String>)/set_arrival_time(Option<String>):
required: falseTime of arrival at the destination.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-04-22T17:57:24+02:00avoid(IsolineAvoidanceOptions)/set_avoid(Option<IsolineAvoidanceOptions>):
required: falseFeatures that are avoided while calculating a route. Avoidance is on a best-case basis. If an avoidance can’t be satisfied for a particular case, it violates the avoidance and the returned response produces a notice for the violation.
depart_now(bool)/set_depart_now(Option<bool>):
required: falseUses the current time as the time of departure.
departure_time(impl Into<String>)/set_departure_time(Option<String>):
required: falseTime of departure from thr origin.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-04-22T17:57:24+02:00destination(f64)/set_destination(Option<Vec::<f64>>):
required: falseThe final position for the route. In the World Geodetic System (WGS 84) format:
[longitude, latitude].destination_options(IsolineDestinationOptions)/set_destination_options(Option<IsolineDestinationOptions>):
required: falseDestination related options.
isoline_geometry_format(GeometryFormat)/set_isoline_geometry_format(Option<GeometryFormat>):
required: falseThe format of the returned IsolineGeometry.
Default Value:
FlexiblePolylineisoline_granularity(IsolineGranularityOptions)/set_isoline_granularity(Option<IsolineGranularityOptions>):
required: falseDefines the granularity of the returned Isoline.
key(impl Into<String>)/set_key(Option<String>):
required: falseOptional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.
optimize_isoline_for(IsolineOptimizationObjective)/set_optimize_isoline_for(Option<IsolineOptimizationObjective>):
required: falseSpecifies the optimization criteria for when calculating an isoline. AccurateCalculation generates an isoline of higher granularity that is more precise. FastCalculation generates an isoline faster by reducing the granularity, and in turn the quality of the isoline. BalancedCalculation generates an isoline by balancing between quality and performance.
Default Value:
BalancedCalculationoptimize_routing_for(RoutingObjective)/set_optimize_routing_for(Option<RoutingObjective>):
required: falseSpecifies the optimization criteria for calculating a route.
Default Value:
FastestRouteorigin(f64)/set_origin(Option<Vec::<f64>>):
required: falseThe start position for the route.
origin_options(IsolineOriginOptions)/set_origin_options(Option<IsolineOriginOptions>):
required: falseOrigin related options.
thresholds(IsolineThresholds)/set_thresholds(Option<IsolineThresholds>):
required: trueThreshold to be used for the isoline calculation. Up to 3 thresholds per provided type can be requested.
You incur a calculation charge for each threshold. Using a large amount of thresholds in a request can lead you to incur unexpected charges. See Amazon Location’s pricing page for more information.
traffic(IsolineTrafficOptions)/set_traffic(Option<IsolineTrafficOptions>):
required: falseTraffic related options.
travel_mode(IsolineTravelMode)/set_travel_mode(Option<IsolineTravelMode>):
required: falseSpecifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility.
The mode
Scooteralso applies to motorcycles, set toScooterwhen wanted to calculate options for motorcycles.Default Value:
Cartravel_mode_options(IsolineTravelModeOptions)/set_travel_mode_options(Option<IsolineTravelModeOptions>):
required: falseTravel mode related options for the provided travel mode.
- On success, responds with
CalculateIsolinesOutputwith field(s):arrival_time(Option<String>):Time of arrival at the destination. This parameter is returned only if the Destination parameters was provided in the request.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-04-22T17:57:24+02:00departure_time(Option<String>):Time of departure from thr origin.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-04-22T17:57:24+02:00isoline_geometry_format(GeometryFormat):The format of the returned IsolineGeometry.
Default Value:
FlexiblePolylineisolines(Vec::<Isoline>):Calculated isolines and associated properties.
pricing_bucket(String):The pricing bucket for which the query is charged at.
snapped_destination(Option<Vec::<f64>>):Snapped destination that was used for the Isoline calculation.
snapped_origin(Option<Vec::<f64>>):Snapped origin that was used for the Isoline calculation.
- On failure, responds with
SdkError<CalculateIsolinesError>
Source§impl Client
impl Client
Sourcepub fn calculate_route_matrix(&self) -> CalculateRouteMatrixFluentBuilder
pub fn calculate_route_matrix(&self) -> CalculateRouteMatrixFluentBuilder
Constructs a fluent builder for the CalculateRouteMatrix operation.
- The fluent builder is configurable:
allow(RouteMatrixAllowOptions)/set_allow(Option<RouteMatrixAllowOptions>):
required: falseFeatures that are allowed while calculating a route.
avoid(RouteMatrixAvoidanceOptions)/set_avoid(Option<RouteMatrixAvoidanceOptions>):
required: falseFeatures that are avoided while calculating a route. Avoidance is on a best-case basis. If an avoidance can’t be satisfied for a particular case, it violates the avoidance and the returned response produces a notice for the violation.
depart_now(bool)/set_depart_now(Option<bool>):
required: falseUses the current time as the time of departure.
departure_time(impl Into<String>)/set_departure_time(Option<String>):
required: falseTime of departure from thr origin.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-04-22T17:57:24+02:00destinations(RouteMatrixDestination)/set_destinations(Option<Vec::<RouteMatrixDestination>>):
required: trueList of destinations for the route.
Route calculations are billed for each origin and destination pair. If you use a large matrix of origins and destinations, your costs will increase accordingly. See Amazon Location’s pricing page for more information.
exclude(RouteMatrixExclusionOptions)/set_exclude(Option<RouteMatrixExclusionOptions>):
required: falseFeatures to be strictly excluded while calculating the route.
key(impl Into<String>)/set_key(Option<String>):
required: falseOptional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.
optimize_routing_for(RoutingObjective)/set_optimize_routing_for(Option<RoutingObjective>):
required: falseSpecifies the optimization criteria for calculating a route.
Default Value:
FastestRouteorigins(RouteMatrixOrigin)/set_origins(Option<Vec::<RouteMatrixOrigin>>):
required: trueThe position in longitude and latitude for the origin.
Route calculations are billed for each origin and destination pair. Using a large amount of Origins in a request can lead you to incur unexpected charges. See Amazon Location’s pricing page for more information.
routing_boundary(RouteMatrixBoundary)/set_routing_boundary(Option<RouteMatrixBoundary>):
required: trueBoundary within which the matrix is to be calculated. All data, origins and destinations outside the boundary are considered invalid.
When request routing boundary was set as AutoCircle, the response routing boundary will return Circle derived from the AutoCircle settings.
traffic(RouteMatrixTrafficOptions)/set_traffic(Option<RouteMatrixTrafficOptions>):
required: falseTraffic related options.
travel_mode(RouteMatrixTravelMode)/set_travel_mode(Option<RouteMatrixTravelMode>):
required: falseSpecifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility.
Default Value:
Cartravel_mode_options(RouteMatrixTravelModeOptions)/set_travel_mode_options(Option<RouteMatrixTravelModeOptions>):
required: falseTravel mode related options for the provided travel mode.
- On success, responds with
CalculateRouteMatrixOutputwith field(s):error_count(i32):The count of error results in the route matrix. If this number is 0, all routes were calculated successfully.
pricing_bucket(String):The pricing bucket for which the query is charged at.
route_matrix(Vec::<Vec::<RouteMatrixEntry>>):The calculated route matrix containing the results for all pairs of Origins to Destination positions. Each row corresponds to one entry in Origins. Each entry in the row corresponds to the route from that entry in Origins to an entry in Destination positions.
routing_boundary(Option<RouteMatrixBoundary>):Boundary within which the matrix is to be calculated. All data, origins and destinations outside the boundary are considered invalid.
When request routing boundary was set as AutoCircle, the response routing boundary will return Circle derived from the AutoCircle settings.
- On failure, responds with
SdkError<CalculateRouteMatrixError>
Source§impl Client
impl Client
Sourcepub fn calculate_routes(&self) -> CalculateRoutesFluentBuilder
pub fn calculate_routes(&self) -> CalculateRoutesFluentBuilder
Constructs a fluent builder for the CalculateRoutes operation.
- The fluent builder is configurable:
allow(RouteAllowOptions)/set_allow(Option<RouteAllowOptions>):
required: falseFeatures that are allowed while calculating a route.
arrival_time(impl Into<String>)/set_arrival_time(Option<String>):
required: falseTime of arrival at the destination.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-04-22T17:57:24+02:00avoid(RouteAvoidanceOptions)/set_avoid(Option<RouteAvoidanceOptions>):
required: falseFeatures that are avoided while calculating a route. Avoidance is on a best-case basis. If an avoidance can’t be satisfied for a particular case, it violates the avoidance and the returned response produces a notice for the violation.
depart_now(bool)/set_depart_now(Option<bool>):
required: falseUses the current time as the time of departure.
departure_time(impl Into<String>)/set_departure_time(Option<String>):
required: falseTime of departure from thr origin.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-04-22T17:57:24+02:00destination(f64)/set_destination(Option<Vec::<f64>>):
required: trueThe final position for the route. In the World Geodetic System (WGS 84) format:
[longitude, latitude].destination_options(RouteDestinationOptions)/set_destination_options(Option<RouteDestinationOptions>):
required: falseDestination related options.
driver(RouteDriverOptions)/set_driver(Option<RouteDriverOptions>):
required: falseDriver related options.
exclude(RouteExclusionOptions)/set_exclude(Option<RouteExclusionOptions>):
required: falseFeatures to be strictly excluded while calculating the route.
instructions_measurement_system(MeasurementSystem)/set_instructions_measurement_system(Option<MeasurementSystem>):
required: falseMeasurement system to be used for instructions within steps in the response.
key(impl Into<String>)/set_key(Option<String>):
required: falseOptional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.
languages(impl Into<String>)/set_languages(Option<Vec::<String>>):
required: falseList of languages for instructions within steps in the response.
Instructions in the requested language are returned only if they are available.
leg_additional_features(RouteLegAdditionalFeature)/set_leg_additional_features(Option<Vec::<RouteLegAdditionalFeature>>):
required: falseA list of optional additional parameters such as timezone that can be requested for each result.
-
Elevation: Retrieves the elevation information for each location. -
Incidents: Provides information on traffic incidents along the route. -
PassThroughWaypoints: Indicates waypoints that are passed through without stopping. -
Summary: Returns a summary of the route, including distance and duration. -
Tolls: Supplies toll cost information along the route. -
TravelStepInstructions: Provides step-by-step instructions for travel along the route. -
TruckRoadTypes: Returns information about road types suitable for trucks. -
TypicalDuration: Gives typical travel duration based on historical data. -
Zones: Specifies the time zone information for each waypoint.
-
leg_geometry_format(GeometryFormat)/set_leg_geometry_format(Option<GeometryFormat>):
required: falseSpecifies the format of the geometry returned for each leg of the route. You can choose between two different geometry encoding formats.
FlexiblePolyline: A compact and precise encoding format for the leg geometry. For more information on the format, see the GitHub repository forFlexiblePolyline.Simple: A less compact encoding, which is easier to decode but may be less precise and result in larger payloads.max_alternatives(i32)/set_max_alternatives(Option<i32>):
required: falseMaximum number of alternative routes to be provided in the response, if available.
optimize_routing_for(RoutingObjective)/set_optimize_routing_for(Option<RoutingObjective>):
required: falseSpecifies the optimization criteria for calculating a route.
Default Value:
FastestRouteorigin(f64)/set_origin(Option<Vec::<f64>>):
required: trueThe start position for the route.
origin_options(RouteOriginOptions)/set_origin_options(Option<RouteOriginOptions>):
required: falseOrigin related options.
span_additional_features(RouteSpanAdditionalFeature)/set_span_additional_features(Option<Vec::<RouteSpanAdditionalFeature>>):
required: falseA list of optional features such as SpeedLimit that can be requested for a Span. A span is a section of a Leg for which the requested features have the same values.
tolls(RouteTollOptions)/set_tolls(Option<RouteTollOptions>):
required: falseToll related options.
traffic(RouteTrafficOptions)/set_traffic(Option<RouteTrafficOptions>):
required: falseTraffic related options.
travel_mode(RouteTravelMode)/set_travel_mode(Option<RouteTravelMode>):
required: falseSpecifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility.
Default Value:
Cartravel_mode_options(RouteTravelModeOptions)/set_travel_mode_options(Option<RouteTravelModeOptions>):
required: falseTravel mode related options for the provided travel mode.
travel_step_type(RouteTravelStepType)/set_travel_step_type(Option<RouteTravelStepType>):
required: falseType of step returned by the response. Default provides basic steps intended for web based applications. TurnByTurn provides detailed instructions with more granularity intended for a turn based navigation system.
waypoints(RouteWaypoint)/set_waypoints(Option<Vec::<RouteWaypoint>>):
required: falseList of waypoints between the Origin and Destination.
- On success, responds with
CalculateRoutesOutputwith field(s):leg_geometry_format(GeometryFormat):Specifies the format of the geometry returned for each leg of the route.
notices(Vec::<RouteResponseNotice>):Notices are additional information returned that indicate issues that occurred during route calculation.
pricing_bucket(String):The pricing bucket for which the query is charged at.
routes(Vec::<Route>):The path from the origin to the destination.
- On failure, responds with
SdkError<CalculateRoutesError>
Source§impl Client
impl Client
Sourcepub fn optimize_waypoints(&self) -> OptimizeWaypointsFluentBuilder
pub fn optimize_waypoints(&self) -> OptimizeWaypointsFluentBuilder
Constructs a fluent builder for the OptimizeWaypoints operation.
- The fluent builder is configurable:
avoid(WaypointOptimizationAvoidanceOptions)/set_avoid(Option<WaypointOptimizationAvoidanceOptions>):
required: falseFeatures that are avoided. Avoidance is on a best-case basis. If an avoidance can’t be satisfied for a particular case, this setting is ignored.
clustering(WaypointOptimizationClusteringOptions)/set_clustering(Option<WaypointOptimizationClusteringOptions>):
required: falseClustering allows you to specify how nearby waypoints can be clustered to improve the optimized sequence.
departure_time(impl Into<String>)/set_departure_time(Option<String>):
required: falseDeparture time from the waypoint.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mmExamples:
2020-04-22T17:57:24Z2020-04-22T17:57:24+02:00destination(f64)/set_destination(Option<Vec::<f64>>):
required: falseThe final position for the route in the World Geodetic System (WGS 84) format:
[longitude, latitude].destination_options(WaypointOptimizationDestinationOptions)/set_destination_options(Option<WaypointOptimizationDestinationOptions>):
required: falseDestination related options.
driver(WaypointOptimizationDriverOptions)/set_driver(Option<WaypointOptimizationDriverOptions>):
required: falseDriver related options.
exclude(WaypointOptimizationExclusionOptions)/set_exclude(Option<WaypointOptimizationExclusionOptions>):
required: falseFeatures to be strictly excluded while calculating the route.
key(impl Into<String>)/set_key(Option<String>):
required: falseOptional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.
optimize_sequencing_for(WaypointOptimizationSequencingObjective)/set_optimize_sequencing_for(Option<WaypointOptimizationSequencingObjective>):
required: falseSpecifies the optimization criteria for the calculated sequence.
Default Value:
FastestRoute.origin(f64)/set_origin(Option<Vec::<f64>>):
required: trueThe start position for the route.
origin_options(WaypointOptimizationOriginOptions)/set_origin_options(Option<WaypointOptimizationOriginOptions>):
required: falseOrigin related options.
traffic(WaypointOptimizationTrafficOptions)/set_traffic(Option<WaypointOptimizationTrafficOptions>):
required: falseTraffic-related options.
travel_mode(WaypointOptimizationTravelMode)/set_travel_mode(Option<WaypointOptimizationTravelMode>):
required: falseSpecifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility.
Default Value:
Cartravel_mode_options(WaypointOptimizationTravelModeOptions)/set_travel_mode_options(Option<WaypointOptimizationTravelModeOptions>):
required: falseTravel mode related options for the provided travel mode.
waypoints(WaypointOptimizationWaypoint)/set_waypoints(Option<Vec::<WaypointOptimizationWaypoint>>):
required: falseList of waypoints between the
OriginandDestination.
- On success, responds with
OptimizeWaypointsOutputwith field(s):connections(Vec::<WaypointOptimizationConnection>):Details about the connection from one waypoint to the next, within the optimized sequence.
distance(i64):Overall distance to travel the whole sequence.
duration(i64):Overall duration to travel the whole sequence.
Unit:
secondsimpeding_waypoints(Vec::<WaypointOptimizationImpedingWaypoint>):Returns waypoints that caused the optimization problem to fail, and the constraints that were unsatisfied leading to the failure.
optimized_waypoints(Vec::<WaypointOptimizationOptimizedWaypoint>):Waypoints in the order of the optimized sequence.
pricing_bucket(String):The pricing bucket for which the query is charged at.
time_breakdown(Option<WaypointOptimizationTimeBreakdown>):Time breakdown for the sequence.
- On failure, responds with
SdkError<OptimizeWaypointsError>
Source§impl Client
impl Client
Sourcepub fn snap_to_roads(&self) -> SnapToRoadsFluentBuilder
pub fn snap_to_roads(&self) -> SnapToRoadsFluentBuilder
Constructs a fluent builder for the SnapToRoads operation.
- The fluent builder is configurable:
key(impl Into<String>)/set_key(Option<String>):
required: falseOptional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.
snapped_geometry_format(GeometryFormat)/set_snapped_geometry_format(Option<GeometryFormat>):
required: falseChooses what the returned SnappedGeometry format should be.
Default Value:
FlexiblePolylinesnap_radius(i64)/set_snap_radius(Option<i64>):
required: falseThe radius around the provided tracepoint that is considered for snapping.
Unit:
metersDefault value:
300trace_points(RoadSnapTracePoint)/set_trace_points(Option<Vec::<RoadSnapTracePoint>>):
required: trueList of trace points to be snapped onto the road network.
travel_mode(RoadSnapTravelMode)/set_travel_mode(Option<RoadSnapTravelMode>):
required: falseSpecifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility.
Default Value:
Cartravel_mode_options(RoadSnapTravelModeOptions)/set_travel_mode_options(Option<RoadSnapTravelModeOptions>):
required: falseTravel mode related options for the provided travel mode.
- On success, responds with
SnapToRoadsOutputwith field(s):notices(Vec::<RoadSnapNotice>):Notices are additional information returned that indicate issues that occurred during route calculation.
pricing_bucket(String):The pricing bucket for which the query is charged at.
snapped_geometry(Option<RoadSnapSnappedGeometry>):The interpolated geometry for the snapped route onto the road network.
snapped_geometry_format(GeometryFormat):Specifies the format of the geometry returned for each leg of the route.
snapped_trace_points(Vec::<RoadSnapSnappedTracePoint>):The trace points snapped onto the road network.
- On failure, responds with
SdkError<SnapToRoadsError>
Source§impl Client
impl Client
Sourcepub fn from_conf(conf: Config) -> Self
pub fn from_conf(conf: Config) -> Self
Creates a new client from the service Config.
§Panics
This method will panic in the following cases:
- Retries or timeouts are enabled without a
sleep_implconfigured. - Identity caching is enabled without a
sleep_implandtime_sourceconfigured. - No
behavior_versionis provided.
The panic message for each of these will have instructions on how to resolve them.
Source§impl Client
impl Client
Sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
§Panics
- This method will panic if the
sdk_configis missing an async sleep implementation. If you experience this panic, set thesleep_implon the Config passed into this function to fix it. - This method will panic if the
sdk_configis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it. - This method will panic if no
BehaviorVersionis provided. If you experience this panic, setbehavior_versionon the Config or enable thebehavior-version-latestCargo feature.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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> 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>
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>
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);