Struct openmensa_rs::request::DayRequest [−][src]
pub struct DayRequest { /* fields omitted */ }
Expand description
Struct to create and then issue requests to see a range of opening days.
Example
use openmensa_rs::request::DayRequest; // As an example we just use the canteen with id `1` here let req = DayRequest::new(1); let list_of_days = req.build().await.unwrap(); println!("{:?}", list_of_days);
Implementations
impl DayRequest
[src]
impl DayRequest
[src]pub fn new(canteen_id: u16) -> Self
[src]
pub fn new(canteen_id: u16) -> Self
[src]Create a new instance to get opening days from a specific canteen.
If you want to issue multiple requests, this struct implements Clone
so before you issue a request simply .clone()
if you need it later on.
pub fn with_start_date(self, start_date: Date<Utc>) -> Self
[src]
pub fn with_start_date(self, start_date: Date<Utc>) -> Self
[src]Specfiy a start date from which opening days should be returned from. By default this is the current date, but you may specify another if you want e.g. to know the dates in a week or two.
pub async fn build(self) -> Result<Vec<Day>, RequestError>
[src]
pub async fn build(self) -> Result<Vec<Day>, 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.
Example
use openmensa_rs::request::DayRequest; let canteen_id = 1; let open_days = DayRequest::new(canteen_id) .with_start_date( chrono::Utc::today() ) .build() .await .unwrap();
Trait Implementations
impl Clone for DayRequest
[src]
impl Clone for DayRequest
[src]fn clone(&self) -> DayRequest
[src]
fn clone(&self) -> DayRequest
[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 Serialize for DayRequest
[src]
impl Serialize for DayRequest
[src]Auto Trait Implementations
impl RefUnwindSafe for DayRequest
impl Send for DayRequest
impl Sync for DayRequest
impl Unpin for DayRequest
impl UnwindSafe for DayRequest
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