pub struct Config {
pub items: Vec<ConfigItem>,
pub include_context: Vec<String>,
}Expand description
Root node of a parsed nginx configuration file.
Use directives() for top-level directives only, or
all_directives() to recurse into blocks.
Call to_source() to reconstruct the source text.
Fields§
§items: Vec<ConfigItem>Top-level items (directives, comments, blank lines).
include_context: Vec<String>Context from parent file when this config was included Empty for root file, e.g., [“http”, “server”] for a file included in server block
Implementations§
Source§impl Config
impl Config
pub fn new() -> Config
Sourcepub fn directives(&self) -> impl Iterator<Item = &Directive>
pub fn directives(&self) -> impl Iterator<Item = &Directive>
Returns an iterator over top-level directives (excludes comments and blank lines)
Sourcepub fn all_directives(&self) -> AllDirectives<'_>
pub fn all_directives(&self) -> AllDirectives<'_>
Returns an iterator over all directives recursively (for lint rules)
Trait Implementations§
Source§impl ConfigExt for Config
impl ConfigExt for Config
Source§fn all_directives(&self) -> AllDirectivesIter<'_> ⓘ
fn all_directives(&self) -> AllDirectivesIter<'_> ⓘ
Iterate over all directives recursively. Read more
Source§fn all_directives_with_context(&self) -> AllDirectivesWithContextIter<'_> ⓘ
fn all_directives_with_context(&self) -> AllDirectivesWithContextIter<'_> ⓘ
Iterate over all directives with parent context information. Read more
Source§fn is_included_from(&self, context: &str) -> bool
fn is_included_from(&self, context: &str) -> bool
Check if this config is included from within a specific context.
Source§fn is_included_from_http(&self) -> bool
fn is_included_from_http(&self) -> bool
Check if this config is included from within
http context.Source§fn is_included_from_http_server(&self) -> bool
fn is_included_from_http_server(&self) -> bool
Check if this config is included from within
http > server context.Source§fn is_included_from_http_location(&self) -> bool
fn is_included_from_http_location(&self) -> bool
Check if this config is included from within
http > ... > location context.Source§fn is_included_from_stream(&self) -> bool
fn is_included_from_stream(&self) -> bool
Check if this config is included from within
stream context.Source§fn immediate_parent_context(&self) -> Option<&str>
fn immediate_parent_context(&self) -> Option<&str>
Get the immediate parent context (last element in include_context).
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Config, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Config, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Config
impl Serialize for Config
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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