pub struct Server {
pub server_names: Vec<String>,
pub listen: Vec<ListenDirective>,
pub root: Option<PathBuf>,
pub locations: Vec<Location>,
pub access_logs: Vec<AccessLog>,
pub error_logs: Vec<ErrorLog>,
pub index: Vec<String>,
}Expand description
Represents an NGINX server block
Fields§
§server_names: Vec<String>Server names (from server_name directive)
listen: Vec<ListenDirective>Listen directives
root: Option<PathBuf>Root directory
locations: Vec<Location>Location blocks
access_logs: Vec<AccessLog>Access logs specific to this server
error_logs: Vec<ErrorLog>Error logs specific to this server
index: Vec<String>Index files
Implementations§
Source§impl Server
impl Server
Sourcepub fn with_server_name(self, name: impl Into<String>) -> Self
pub fn with_server_name(self, name: impl Into<String>) -> Self
Add a server name
Sourcepub fn with_listen(self, listen: ListenDirective) -> Self
pub fn with_listen(self, listen: ListenDirective) -> Self
Add a listen directive
Sourcepub fn is_default_server(&self) -> bool
pub fn is_default_server(&self) -> bool
Check if server is default
Sourcepub fn primary_name(&self) -> Option<&str>
pub fn primary_name(&self) -> Option<&str>
Get primary server name
Sourcepub fn with_index(self, index: impl Into<String>) -> Self
pub fn with_index(self, index: impl Into<String>) -> Self
Add an index file
Sourcepub fn with_location(self, location: Location) -> Self
pub fn with_location(self, location: Location) -> Self
Add a location block
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Server
impl<'de> Deserialize<'de> for Server
Source§fn 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
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more