pub struct VideoLocation { /* private fields */ }Implementations§
Source§impl VideoLocation
impl VideoLocation
Sourcepub fn new(longitude: f32, latitude: f32) -> Self
pub fn new(longitude: f32, latitude: f32) -> Self
Examples found in repository?
examples/complex_search.rs (line 19)
9fn main() -> Result<(), Error> {
10 futures::executor::block_on(async {
11 // take api key from enviroment variable
12 let key = ApiKey::new(&env::var("YT_API_KEY").expect("YT_API_KEY env-var not found"));
13
14 // create the SearchList struct for the query "rust lang"
15 let result = SearchList::new(key)
16 .q("rust lang")
17 .max_results(1)
18 .item_type(ItemType::Video)
19 .location(VideoLocation::new(40.73061, -73.93524))
20 .location_radius("100km")
21 .video_embeddable()
22 .await?;
23
24 // outputs the video_id of the first search result
25 println!(
26 "Title: \"{}\"",
27 result.items[0].snippet.title.as_ref().unwrap()
28 );
29 println!(
30 "https://youtube.com/watch?v={}",
31 result.items[0].id.video_id.as_ref().unwrap()
32 );
33
34 Ok(())
35 })
36}Trait Implementations§
Source§impl Clone for VideoLocation
impl Clone for VideoLocation
Source§fn clone(&self) -> VideoLocation
fn clone(&self) -> VideoLocation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VideoLocation
impl Debug for VideoLocation
Auto Trait Implementations§
impl Freeze for VideoLocation
impl RefUnwindSafe for VideoLocation
impl Send for VideoLocation
impl Sync for VideoLocation
impl Unpin for VideoLocation
impl UnwindSafe for VideoLocation
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
Mutably borrows from an owned value. Read more