Assets

Struct Assets 

Source
pub struct Assets;
Expand description

Assets from swagger-ui-dist

Implementations§

Source§

impl Assets

Source

pub fn get(file_path: &str) -> Option<Cow<'static, [u8]>>

Source

pub fn iter() -> impl Iterator<Item = Cow<'static, str>>

Examples found in repository?
examples/basic.rs (line 6)
3fn main() {
4    println!("swagger-ui bundles files:");
5    // Use Assets::iter() to get iterator of all filenames
6    for file in Assets::iter() {
7        let filename = file.as_ref();
8        println!("\t{}", filename);
9        // `Assets::get(filename)` returns file content
10    };
11
12    // Load openapi spec (compile-time)
13    let _spec: Spec = swagger_spec_file!("./openapi.json");
14
15    // swagger-ui configuration struct
16    let _config: Config = Config {
17        url: "".to_string(),
18        urls: vec![],
19        deep_linking: false,
20        display_operation_id: false,
21        default_models_expand_depth: 0,
22        default_model_expand_depth: 0,
23        default_model_rendering: DefaultModelRendering::Example,
24        display_request_duration: false,
25        doc_expansion: DocExpansion::List,
26        filter: Filter::Bool(false),
27        max_displayed_tags: 0,
28        show_extensions: false,
29        show_common_extensions: false
30    };
31}

Trait Implementations§

Source§

impl RustEmbed for Assets

Source§

fn get(file_path: &str) -> Option<Cow<'static, [u8]>>

Given a relative path from the assets folder, returns the bytes if found. Read more
Source§

fn iter() -> Filenames

Iterates the files in this assets folder. Read more

Auto Trait Implementations§

§

impl Freeze for Assets

§

impl RefUnwindSafe for Assets

§

impl Send for Assets

§

impl Sync for Assets

§

impl Unpin for Assets

§

impl UnwindSafe for Assets

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.