#[non_exhaustive]pub struct Server {
pub url: String,
pub description: Option<String>,
pub variables: Option<BTreeMap<String, ServerVariable>>,
pub extensions: Option<Extensions>,
}
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<BTreeMap<String, ServerVariable>>
Optional map of variable name and its substitution value used in Server::url
.
extensions: Option<Extensions>
Optional extensions “x-something”.
Implementations§
Source§impl Server
impl Server
Sourcepub fn builder() -> ServerBuilder
pub fn builder() -> ServerBuilder
Construct a new ServerBuilder.
This is effectively same as calling ServerBuilder::new
Source§impl Server
impl Server
Sourcepub fn new<S>(url: S) -> Server
pub fn new<S>(url: S) -> Server
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§
Source§impl<'de> Deserialize<'de> for Server
impl<'de> Deserialize<'de> for Server
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Server, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Server, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<Server> for ServerBuilder
impl From<Server> for ServerBuilder
Source§fn from(value: Server) -> ServerBuilder
fn from(value: Server) -> ServerBuilder
Source§impl From<ServerBuilder> for Server
impl From<ServerBuilder> for Server
Source§fn from(value: ServerBuilder) -> Server
fn from(value: ServerBuilder) -> Server
Source§impl Serialize for Server
impl Serialize for Server
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Server
impl StructuralPartialEq for Server
Auto Trait Implementations§
impl Freeze for Server
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnwindSafe for Server
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.