#[non_exhaustive]pub struct Server {
pub url: String,
pub description: Option<String>,
pub variables: Option<HashMap<String, ServerVariable>>,
}
Expand description
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.url: String
Target url of the Server
. It can be valid http url or relative path.
Url also supports variable substitution with {variable}
syntax. The substitutions
then can be configured with Server::variables
map.
description: Option<String>
Optional description describing the target server url. Description supports markdown syntax.
variables: Option<HashMap<String, ServerVariable>>
Optional map of variable name and its substitution value used in Server::url
.
Implementations
sourceimpl Server
impl Server
sourcepub fn new<S: Into<String>>(url: S) -> Self
pub fn new<S: Into<String>>(url: S) -> Self
Construct a new Server
with given url. Url can be valid http url or context path of the url.
If url is valid http url then all path operation request’s will be forwarded to the selected Server
.
If url is path of url e.g. /api/v1
then the url will be appended to the servers address and the
operations will be forwarded to location server address + url
.
Examples
Create new server with url path.
Server::new("/api/v1");
Create new server with alternative server.
Server::new("https://alternative.pet-api.test/api/v1");
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Server
impl<'de> Deserialize<'de> for Server
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Server> for ServerBuilder
impl From<Server> for ServerBuilder
sourceimpl From<ServerBuilder> for Server
impl From<ServerBuilder> for Server
sourcefn from(value: ServerBuilder) -> Self
fn from(value: ServerBuilder) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnwindSafe for Server
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more