Module prelude

Module prelude 

Source
Expand description

Prelude module for convenient imports.

Importing everything from this module is the recommended way to use the SDK:

use nginx_lint_plugin::prelude::*;

// All core types are now available
let spec = PluginSpec::new("example", "test", "Example rule");
assert_eq!(spec.name, "example");

This re-exports all core types (Plugin, PluginSpec, LintError, Fix, Config, Directive, etc.), extension traits (ConfigExt, DirectiveExt), the helpers module, and the export_component_plugin! macro.

Re-exports§

pub use super::helpers;

Macros§

export_component_plugin
Macro to export a plugin as a WIT component

Structs§

AllDirectivesWithContextIter
Iterator over all directives with their parent context.
Argument
A single argument to a directive.
Block
A brace-delimited block ({ … }).
Comment
A comment (# …)
Config
Root node of a parsed nginx configuration file.
Directive
A directive — either a simple directive (listen 80;) or a block directive (server { … }).
DirectiveWithContext
A directive paired with its parent block context.
ErrorBuilder
Builder for creating LintError with pre-filled rule and category
Fix
Represents a fix that can be applied to automatically resolve a lint error.
LintError
A lint error reported by a plugin.
PluginSpec
Plugin metadata describing a lint rule.
Position
A position (line, column, byte offset) in the source text.
Span
A half-open source range defined by a start and end Position.

Enums§

ArgumentValue
The kind and value of a directive argument.
ConfigItem
An item in the configuration (directive, comment, or blank line).
Severity
Severity level for lint errors

Constants§

API_VERSION
Current API version for the plugin SDK

Traits§

ArgumentExt
Extension trait for Argument to add source reconstruction
ConfigExt
Extension trait for Config providing iteration and include-context helpers.
DirectiveExt
Extension trait for Directive providing inspection and fix-generation helpers.
Plugin
Trait that all plugins must implement.