Struct parsoid::Client [−][src]
HTTP client to get Parsoid HTML from MediaWiki's Rest APIs
Note: This requires the http
feature is enabled (it is by default).
Implementations
impl Client
[src]
pub fn new(base_url: &str, user_agent: &str) -> Result<Self>
[src]
Create a new Client. base_url
should either point to rest.php
or
Restbase. For Wikimedia projects it would look something like:
https://en.wikipedia.org/api/rest_v1
. For other wikis it might be:
https://wiki.example.org/rest.php/wiki.example.org/v3
.
(Note: no trailing slash on either endpoint style.)
pub async fn get(&self, page: &str) -> Result<Wikicode>
[src]
Get a Wikicode
instance for the specified page
pub async fn get_raw(&self, page: &str) -> Result<String>
[src]
Get the Parsoid HTML for the specified page
pub async fn transform_to_html(&self, wikitext: &str) -> Result<Wikicode>
[src]
Get a Wikicode
instance for the specified wikitext
pub async fn transform_to_html_raw(&self, wikitext: &str) -> Result<String>
[src]
Get the Parsoid HTML for the specified wikitext
pub async fn transform_to_wikitext(&self, code: &Wikicode) -> Result<String>
[src]
Get the wikitext for the specified Parsoid HTML
pub async fn transform_to_wikitext_raw(&self, html: &str) -> Result<String>
[src]
Get the wikitext for the specified Parsoid HTML
Auto Trait Implementations
impl !RefUnwindSafe for Client
[src]
impl Send for Client
[src]
impl Sync for Client
[src]
impl Unpin for Client
[src]
impl !UnwindSafe for Client
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,