aws-sdk-location 0.26.0

AWS SDK for Amazon Location Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p> Represents an element of a leg within a route. A step contains instructions for how to move to the next step in the leg. </p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct Step {
    /// <p>The starting position of a step. If the position is the first step in the leg, this position is the same as the start position of the leg.</p>
    #[doc(hidden)]
    pub start_position: std::option::Option<std::vec::Vec<f64>>,
    /// <p>The end position of a step. If the position the last step in the leg, this position is the same as the end position of the leg.</p>
    #[doc(hidden)]
    pub end_position: std::option::Option<std::vec::Vec<f64>>,
    /// <p>The travel distance between the step's <code>StartPosition</code> and <code>EndPosition</code>.</p>
    #[doc(hidden)]
    pub distance: std::option::Option<f64>,
    /// <p>The estimated travel time, in seconds, from the step's <code>StartPosition</code> to the <code>EndPosition</code>. . The travel mode and departure time that you specify in the request determines the calculated time.</p>
    #[doc(hidden)]
    pub duration_seconds: std::option::Option<f64>,
    /// <p>Represents the start position, or index, in a sequence of steps within the leg's line string geometry. For example, the index of the first step in a leg geometry is <code>0</code>. </p>
    /// <p>Included in the response for queries that set <code>IncludeLegGeometry</code> to <code>True</code>. </p>
    #[doc(hidden)]
    pub geometry_offset: std::option::Option<i32>,
}
impl Step {
    /// <p>The starting position of a step. If the position is the first step in the leg, this position is the same as the start position of the leg.</p>
    pub fn start_position(&self) -> std::option::Option<&[f64]> {
        self.start_position.as_deref()
    }
    /// <p>The end position of a step. If the position the last step in the leg, this position is the same as the end position of the leg.</p>
    pub fn end_position(&self) -> std::option::Option<&[f64]> {
        self.end_position.as_deref()
    }
    /// <p>The travel distance between the step's <code>StartPosition</code> and <code>EndPosition</code>.</p>
    pub fn distance(&self) -> std::option::Option<f64> {
        self.distance
    }
    /// <p>The estimated travel time, in seconds, from the step's <code>StartPosition</code> to the <code>EndPosition</code>. . The travel mode and departure time that you specify in the request determines the calculated time.</p>
    pub fn duration_seconds(&self) -> std::option::Option<f64> {
        self.duration_seconds
    }
    /// <p>Represents the start position, or index, in a sequence of steps within the leg's line string geometry. For example, the index of the first step in a leg geometry is <code>0</code>. </p>
    /// <p>Included in the response for queries that set <code>IncludeLegGeometry</code> to <code>True</code>. </p>
    pub fn geometry_offset(&self) -> std::option::Option<i32> {
        self.geometry_offset
    }
}
impl std::fmt::Debug for Step {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let mut formatter = f.debug_struct("Step");
        formatter.field("start_position", &"*** Sensitive Data Redacted ***");
        formatter.field("end_position", &"*** Sensitive Data Redacted ***");
        formatter.field("distance", &self.distance);
        formatter.field("duration_seconds", &self.duration_seconds);
        formatter.field("geometry_offset", &self.geometry_offset);
        formatter.finish()
    }
}
impl Step {
    /// Creates a new builder-style object to manufacture [`Step`](crate::types::Step).
    pub fn builder() -> crate::types::builders::StepBuilder {
        crate::types::builders::StepBuilder::default()
    }
}

/// A builder for [`Step`](crate::types::Step).
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default)]
pub struct StepBuilder {
    pub(crate) start_position: std::option::Option<std::vec::Vec<f64>>,
    pub(crate) end_position: std::option::Option<std::vec::Vec<f64>>,
    pub(crate) distance: std::option::Option<f64>,
    pub(crate) duration_seconds: std::option::Option<f64>,
    pub(crate) geometry_offset: std::option::Option<i32>,
}
impl StepBuilder {
    /// Appends an item to `start_position`.
    ///
    /// To override the contents of this collection use [`set_start_position`](Self::set_start_position).
    ///
    /// <p>The starting position of a step. If the position is the first step in the leg, this position is the same as the start position of the leg.</p>
    pub fn start_position(mut self, input: f64) -> Self {
        let mut v = self.start_position.unwrap_or_default();
        v.push(input);
        self.start_position = Some(v);
        self
    }
    /// <p>The starting position of a step. If the position is the first step in the leg, this position is the same as the start position of the leg.</p>
    pub fn set_start_position(mut self, input: std::option::Option<std::vec::Vec<f64>>) -> Self {
        self.start_position = input;
        self
    }
    /// Appends an item to `end_position`.
    ///
    /// To override the contents of this collection use [`set_end_position`](Self::set_end_position).
    ///
    /// <p>The end position of a step. If the position the last step in the leg, this position is the same as the end position of the leg.</p>
    pub fn end_position(mut self, input: f64) -> Self {
        let mut v = self.end_position.unwrap_or_default();
        v.push(input);
        self.end_position = Some(v);
        self
    }
    /// <p>The end position of a step. If the position the last step in the leg, this position is the same as the end position of the leg.</p>
    pub fn set_end_position(mut self, input: std::option::Option<std::vec::Vec<f64>>) -> Self {
        self.end_position = input;
        self
    }
    /// <p>The travel distance between the step's <code>StartPosition</code> and <code>EndPosition</code>.</p>
    pub fn distance(mut self, input: f64) -> Self {
        self.distance = Some(input);
        self
    }
    /// <p>The travel distance between the step's <code>StartPosition</code> and <code>EndPosition</code>.</p>
    pub fn set_distance(mut self, input: std::option::Option<f64>) -> Self {
        self.distance = input;
        self
    }
    /// <p>The estimated travel time, in seconds, from the step's <code>StartPosition</code> to the <code>EndPosition</code>. . The travel mode and departure time that you specify in the request determines the calculated time.</p>
    pub fn duration_seconds(mut self, input: f64) -> Self {
        self.duration_seconds = Some(input);
        self
    }
    /// <p>The estimated travel time, in seconds, from the step's <code>StartPosition</code> to the <code>EndPosition</code>. . The travel mode and departure time that you specify in the request determines the calculated time.</p>
    pub fn set_duration_seconds(mut self, input: std::option::Option<f64>) -> Self {
        self.duration_seconds = input;
        self
    }
    /// <p>Represents the start position, or index, in a sequence of steps within the leg's line string geometry. For example, the index of the first step in a leg geometry is <code>0</code>. </p>
    /// <p>Included in the response for queries that set <code>IncludeLegGeometry</code> to <code>True</code>. </p>
    pub fn geometry_offset(mut self, input: i32) -> Self {
        self.geometry_offset = Some(input);
        self
    }
    /// <p>Represents the start position, or index, in a sequence of steps within the leg's line string geometry. For example, the index of the first step in a leg geometry is <code>0</code>. </p>
    /// <p>Included in the response for queries that set <code>IncludeLegGeometry</code> to <code>True</code>. </p>
    pub fn set_geometry_offset(mut self, input: std::option::Option<i32>) -> Self {
        self.geometry_offset = input;
        self
    }
    /// Consumes the builder and constructs a [`Step`](crate::types::Step).
    pub fn build(self) -> crate::types::Step {
        crate::types::Step {
            start_position: self.start_position,
            end_position: self.end_position,
            distance: self.distance,
            duration_seconds: self.duration_seconds,
            geometry_offset: self.geometry_offset,
        }
    }
}
impl std::fmt::Debug for StepBuilder {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let mut formatter = f.debug_struct("StepBuilder");
        formatter.field("start_position", &"*** Sensitive Data Redacted ***");
        formatter.field("end_position", &"*** Sensitive Data Redacted ***");
        formatter.field("distance", &self.distance);
        formatter.field("duration_seconds", &self.duration_seconds);
        formatter.field("geometry_offset", &self.geometry_offset);
        formatter.finish()
    }
}