pub struct OpenApiSpec { /* private fields */ }Expand description
An OpenAPI 3.0 or 3.1 document, parsed from JSON or YAML.
Build it with str::parse (through FromStr), from_file or
fetch, then turn it into tools with OpenApiToolset::new.
Implementations§
Source§impl OpenApiSpec
impl OpenApiSpec
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
Reads the file at path and parses it as FromStr does. A read failure is
Error::Parse naming the path.
Sourcepub async fn fetch(url: &str) -> Result<Self, Error>
pub async fn fetch(url: &str) -> Result<Self, Error>
Downloads the document at url (30 s timeout, at most 10 MiB) and parses it as
FromStr does. A non-2xx status, a transport failure or a larger body is
Error::Fetch. The URL is kept as the base for a relative server URL.
Sourcepub fn source_url(&self) -> Option<&str>
pub fn source_url(&self) -> Option<&str>
The URL the document was fetched from, for a document loaded by
fetch.
Trait Implementations§
Source§impl Clone for OpenApiSpec
impl Clone for OpenApiSpec
Source§impl Debug for OpenApiSpec
impl Debug for OpenApiSpec
Auto Trait Implementations§
impl Forget for OpenApiSpec
impl Freeze for OpenApiSpecwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<(String, Vec<String>)>: Freeze,
impl Move for OpenApiSpec
impl RefUnwindSafe for OpenApiSpec
impl Send for OpenApiSpec
impl Sync for OpenApiSpec
impl Unpin for OpenApiSpec
impl UnsafeUnpin for OpenApiSpecwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<(String, Vec<String>)>: UnsafeUnpin,
impl UnwindSafe for OpenApiSpec
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