pub struct RuleSet<'a> { /* private fields */ }Expand description
Corresponds to SpeculationRuleSet
Implementations§
Source§impl<'a> RuleSet<'a>
impl<'a> RuleSet<'a>
Sourcepub fn builder(
id: impl Into<RuleSetId<'a>>,
loader_id: LoaderId<'a>,
source_text: impl Into<Cow<'a, str>>,
) -> RuleSetBuilder<'a>
pub fn builder( id: impl Into<RuleSetId<'a>>, loader_id: LoaderId<'a>, source_text: impl Into<Cow<'a, str>>, ) -> RuleSetBuilder<'a>
Creates a builder for this type with the required parameters:
id:loader_id: Identifies a document which the rule set is associated with.source_text: Source text of JSON representing the rule set. If it comes from\<script\>tag, it is the textContent of the node. Note that it is a JSON for valid case. See also: - https://wicg.github.io/nav-speculation/speculation-rules.html - https://github.com/WICG/nav-speculation/blob/main/triggers.md
pub fn id(&self) -> &RuleSetId<'a>
Sourcepub fn loader_id(&self) -> &LoaderId<'a>
pub fn loader_id(&self) -> &LoaderId<'a>
Identifies a document which the rule set is associated with.
Sourcepub fn source_text(&self) -> &str
pub fn source_text(&self) -> &str
Source text of JSON representing the rule set. If it comes from ‘<script>’ tag, it is the textContent of the node. Note that it is a JSON for valid case.
See also:
Sourcepub fn backend_node_id(&self) -> Option<&BackendNodeId>
pub fn backend_node_id(&self) -> Option<&BackendNodeId>
A speculation rule set is either added through an inline ‘<script>’ tag or through an external resource via the ‘Speculation-Rules’ HTTP header. For the first case, we include the BackendNodeId of the relevant ‘<script>’ tag. For the second case, we include the external URL where the rule set was loaded from, and also RequestId if Network domain is enabled.
See also:
pub fn url(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&RequestId<'a>>
Sourcepub fn error_type(&self) -> Option<&RuleSetErrorType>
pub fn error_type(&self) -> Option<&RuleSetErrorType>
Error information ‘errorMessage’ is null iff ‘errorType’ is null.
Sourcepub fn error_message(&self) -> Option<&str>
pub fn error_message(&self) -> Option<&str>
TODO(https://crbug.com/1425354): Replace this property with structured error.
Sourcepub fn tag(&self) -> Option<&str>
pub fn tag(&self) -> Option<&str>
For more details, see: https://github.com/WICG/nav-speculation/blob/main/speculation-rules-tags.md