Struct openmensa_rs::request::CanteenRequest [−][src]
pub struct CanteenRequest { /* fields omitted */ }
Expand description
Struct to create a request receiving a list of canteens fitting the specified parameters.
This request does not require any additional information and can be stated as is to retrieve a list of all canteens.
Example
use openmensa_rs::request::CanteenRequest; use openmensa_rs::CoordinatePair; let near_canteens = CanteenRequest::new() .with_near_coordinates( CoordinatePair::new( 52.1396188273019, 11.6475999355316, ) ) .build() .await .unwrap();
Implementations
impl CanteenRequest
[src]
impl CanteenRequest
[src]pub fn new() -> Self
[src]
pub fn new() -> Self
[src]Returns a new instance of a request. If you want to perform the same request again, you do not need to set all parameters anew. Requests are clonable, so to not lose them after building just create a clone!
use openmensa_rs::request::CanteenRequest; let my_super_complex_request = CanteenRequest::new(); let result = my_super_complex_request.clone().build().await.unwrap(); // And we can use it again! let result = my_super_complex_request.build().await.unwrap();
pub fn with_near_coordinates(self, near: CoordinatePair) -> Self
[src]
pub fn with_near_coordinates(self, near: CoordinatePair) -> Self
[src]Specify a CoordinatePair
to which the canteen should be near to.
If not further specified only canteens in a range of up to 10 kilometers will be returned.
If you want to specify the range too, have a look at with_distance_to
method.
pub fn with_distance_to(self, dst: f32, near: CoordinatePair) -> Self
[src]
pub fn with_distance_to(self, dst: f32, near: CoordinatePair) -> Self
[src]Specify a CoordinatePair
and distance to which the canteen should be near too.
pub fn with_id<U: Into<u16>>(self, id: U) -> Self
[src]
pub fn with_id<U: Into<u16>>(self, id: U) -> Self
[src]Add an id that should be included in the response.
Note: If at least one id is specified, only these ids will be included in the response. Even if other canteens would also match all other parameters. The same is true vice versa.
pub fn with_ids<T: Iterator>(self, ids: T) -> Self where
T::Item: Into<u16>,
[src]
pub fn with_ids<T: Iterator>(self, ids: T) -> Self where
T::Item: Into<u16>,
[src]Add multiple ids to the request.
pub fn with_coordinates_requisite(self) -> Self
[src]
pub fn with_coordinates_requisite(self) -> Self
[src]Return only canteens that have specified coordinates.
pub async fn build(self) -> Result<Vec<Canteen>, RequestError>
[src]
pub async fn build(self) -> Result<Vec<Canteen>, RequestError>
[src]Send the request and wait for the response. May return an error if the parameters cannot be serialized or the response cannot be deserialized.
let near_canteens = CanteenRequest::new() .with_near_coordinates( CoordinatePair::new( 52.1396188273019, 11.6475999355316, ) ) .build() .await .unwrap();
Trait Implementations
impl Clone for CanteenRequest
[src]
impl Clone for CanteenRequest
[src]fn clone(&self) -> CanteenRequest
[src]
fn clone(&self) -> CanteenRequest
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Default for CanteenRequest
[src]
impl Default for CanteenRequest
[src]fn default() -> CanteenRequest
[src]
fn default() -> CanteenRequest
[src]Returns the “default value” for a type. Read more
impl Serialize for CanteenRequest
[src]
impl Serialize for CanteenRequest
[src]Auto Trait Implementations
impl RefUnwindSafe for CanteenRequest
impl Send for CanteenRequest
impl Sync for CanteenRequest
impl Unpin for CanteenRequest
impl UnwindSafe for CanteenRequest
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more