pub struct Document { /* private fields */ }Expand description
An OpenAPI document that describes the documented routes of a router.
Create it with OpenApi::generate. Return it
from a route to serve it as JSON, or write it to a file with
to_json_pretty. It also implements
Serialize for other formats.
Implementations§
Source§impl Document
impl Document
Sourcepub fn to_json(&self) -> String
pub fn to_json(&self) -> String
Returns the document as compact JSON.
§Panics
Panics if a schema in the document cannot be written as JSON.
Sourcepub fn to_json_pretty(&self) -> String
pub fn to_json_pretty(&self) -> String
Returns the document as indented JSON, which suits a file kept in version control.
§Panics
Panics if a schema in the document cannot be written as JSON.
Trait Implementations§
Source§impl IntoResponse for &Document
Sends the document as JSON.
impl IntoResponse for &Document
Sends the document as JSON.
Source§impl IntoResponse for Document
Sends the document as JSON.
impl IntoResponse for Document
Sends the document as JSON.
Auto Trait Implementations§
impl Forget for Document
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
Blanket Implementations§
Source§impl<T> AsyncIntoResponse for Twhere
T: IntoResponse,
impl<T> AsyncIntoResponse for Twhere
T: IntoResponse,
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