INNER CODE UNIT · Rust

new

allenai/dolma · src/lib.rs:68

    fn new(rules: Vec<String>) -> Self {
        UrlBlocker {
            engine: Engine::from_rules(&rules, ParseOptions::default()),
        }
    }
    /// The function that should tell whether a specific request should be blocked according to the loaded rules
    ///
    /// input:
    ///     url: str -> The inspected url that should be tested
    ///     source_url: str -> The source url that made the request to the inspected url
    ///     request_type: str -> The type of the resource that is being requested. Can be one of the following:
    ///         "beacon", "csp_report", "document", "font", "image", "imageset", "main_frame",
    ///         "media", "object_subrequest", "object", "other", "ping", "script", "speculative",
    ///         "stylesheet", "sub_frame", "subdocument", "web_manifest", "websocket", "xbl",
    ///         "xhr", "xml_dtd", "xmlhttprequest", "xslt"
    ///
    /// returns:
    ///     bool -> Whether the request should be blocked or not

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…