[−][src]Struct wikipedia::Wikipedia
Fields
client: A
HttpClient struct.
pre_language_url: String
Url is created by concatenating pre_language_url
+ language
+ post_language_url
.
post_language_url: String
language: String
search_results: u32
Number of results to fetch when searching.
images_results: String
Number of images to fetch in each request when calling get_images
.
The iterator will go through all of them, fetching pages of this size.
It can be the string "max" to fetch as many as possible on every request.
links_results: String
Like images_results
, for links and references.
categories_results: String
Like images_results
, for categories.
Methods
impl<A: HttpClient> Wikipedia<A>
[src]
pub fn new(client: A) -> Self
[src]
Creates a new object using the provided client and default values.
pub fn get_languages(&self) -> Result<Vec<(String, String)>>
[src]
Returns a list of languages in the form of (identifier
, language
),
for example [("en", "English"), ("es", "Español")]
pub fn base_url(&self) -> String
[src]
Returns the api url
pub fn set_base_url(&mut self, base_url: &str)
[src]
Updates the url format. The substring {language}
will be replaced
with the selected language.
pub fn search(&self, query: &str) -> Result<Vec<String>>
[src]
Searches for a string and returns a list of relevant page titles.
Examples
extern crate wikipedia; let wiki = wikipedia::Wikipedia::<wikipedia::http::default::Client>::default(); let results = wiki.search("keyboard").unwrap(); assert!(results.contains(&"Computer keyboard".to_owned()));
pub fn geosearch(
&self,
latitude: f64,
longitude: f64,
radius: u16
) -> Result<Vec<String>>
[src]
&self,
latitude: f64,
longitude: f64,
radius: u16
) -> Result<Vec<String>>
Search articles within radius
meters of latitude
and longitude
.
Examples
extern crate wikipedia; let wiki = wikipedia::Wikipedia::<wikipedia::http::default::Client>::default(); let results = wiki.geosearch(40.750556,-73.993611, 20).unwrap(); assert!(results.contains(&"Madison Square Garden".to_owned()));
pub fn random_count(&self, count: u8) -> Result<Vec<String>>
[src]
Fetches count
random articles' title.
pub fn random(&self) -> Result<Option<String>>
[src]
Fetches a random article's title.
pub fn page_from_title<'a>(&'a self, title: String) -> Page<'a, A>
[src]
Creates a new Page
given a title
.
pub fn page_from_pageid<'a>(&'a self, pageid: String) -> Page<'a, A>
[src]
Creates a new Page
given a pageid
.
Trait Implementations
impl<A: HttpClient + Default> Default for Wikipedia<A>
[src]
impl<A: HttpClient + Clone> Clone for Wikipedia<A>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<A: Debug + HttpClient> Debug for Wikipedia<A>
[src]
Auto Trait Implementations
impl<A> Send for Wikipedia<A> where
A: Send,
A: Send,
impl<A> Unpin for Wikipedia<A> where
A: Unpin,
A: Unpin,
impl<A> Sync for Wikipedia<A> where
A: Sync,
A: Sync,
impl<A> UnwindSafe for Wikipedia<A> where
A: UnwindSafe,
A: UnwindSafe,
impl<A> RefUnwindSafe for Wikipedia<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,