1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use crate::places::place_autocomplete::request::Request;
// -----------------------------------------------------------------------------
impl<'a> Request<'a> {
/// Adds the offset parameter to the Place API _Place Autocomplete_ query.
///
/// ## Arguments:
///
/// * `offset` ‧ The position, in the input term, of the last character that
/// the service uses to match predictions. For example, if the input is
/// `Google` and the offset is 3, the service will match on `Goo`. The
/// string determined by the offset is matched against the first word in the
/// input term only. For example, if the input term is `Google abc` and the
/// offset is 3, the service will attempt to match against `Goo abc`. If no
/// offset is supplied, the service will use the whole term. The offset
/// should generally be set to the position of the text caret.
pub fn with_offset(&'a mut self, offset: u8) -> &'a mut Request {
// Set offset in Request struct.
self.offset = Some(offset);
// Return modified Request struct to caller.
self
} // fn
} // impl