pub struct Directive {
pub item: DirectiveItem,
pub span: Span,
}Expand description
A directive in the NGINX configuration
Fields§
§item: DirectiveItemThe directive content (simple or block)
span: SpanSource location
Implementations§
Source§impl Directive
impl Directive
Sourcepub fn simple(name: impl Into<String>, args: Vec<String>) -> Self
pub fn simple(name: impl Into<String>, args: Vec<String>) -> Self
Create a new simple directive
Sourcepub fn simple_with_span(
name: impl Into<String>,
args: Vec<String>,
span: Span,
) -> Self
pub fn simple_with_span( name: impl Into<String>, args: Vec<String>, span: Span, ) -> Self
Create a new simple directive with span
Sourcepub fn simple_with_values(name: impl Into<String>, args: Vec<Value>) -> Self
pub fn simple_with_values(name: impl Into<String>, args: Vec<Value>) -> Self
Create a new simple directive with values
Sourcepub fn block(
name: impl Into<String>,
args: Vec<String>,
children: Vec<Directive>,
) -> Self
pub fn block( name: impl Into<String>, args: Vec<String>, children: Vec<Directive>, ) -> Self
Create a new block directive
Sourcepub fn block_with_span(
name: impl Into<String>,
args: Vec<String>,
children: Vec<Directive>,
span: Span,
) -> Self
pub fn block_with_span( name: impl Into<String>, args: Vec<String>, children: Vec<Directive>, span: Span, ) -> Self
Create a new block directive with span
Sourcepub fn block_with_values(
name: impl Into<String>,
args: Vec<Value>,
children: Vec<Directive>,
) -> Self
pub fn block_with_values( name: impl Into<String>, args: Vec<Value>, children: Vec<Directive>, ) -> Self
Create a new block directive with values
Sourcepub fn children_mut(&mut self) -> Option<&mut Vec<Directive>>
pub fn children_mut(&mut self) -> Option<&mut Vec<Directive>>
Get mutable children if this is a block directive
Sourcepub fn args_as_strings(&self) -> Vec<String>
pub fn args_as_strings(&self) -> Vec<String>
Get all arguments as strings
Sourcepub fn find_children(&self, name: &str) -> Vec<&Directive>
pub fn find_children(&self, name: &str) -> Vec<&Directive>
Find child directives with a specific name
Sourcepub fn find_children_mut(&mut self, name: &str) -> Vec<&mut Directive>
pub fn find_children_mut(&mut self, name: &str) -> Vec<&mut Directive>
Find child directives with a specific name (mutable)
Sourcepub fn find_recursive(&self, name: &str) -> Vec<&Directive>
pub fn find_recursive(&self, name: &str) -> Vec<&Directive>
Recursively find all directives with a given name
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Directive
impl<'de> Deserialize<'de> for Directive
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 Directive
Auto Trait Implementations§
impl Freeze for Directive
impl RefUnwindSafe for Directive
impl Send for Directive
impl Sync for Directive
impl Unpin for Directive
impl UnwindSafe for Directive
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