Skip to main content

detect_url_scheme

Function
This function is defined in the parse_utils module.
Detect URL scheme from a string. O(1) operation.

Signature

def detect_url_scheme(value: &str) -> Option<String>

Parameters

value
&str
required
No description available.

Returns

Returns
Option<String>
The result of the operation.

Usage

use praisonai::parity::parse_utils::detect_url_scheme;

assert_eq!(detect_url_scheme("postgresql://localhost/db"), Some("postgresql".to_string()));
assert_eq!(detect_url_scheme("redis://localhost:6379"), Some("redis".to_string()));
assert_eq!(detect_url_scheme("not a url"), None);

Uses

  • contains
  • find
  • chars
  • all
  • is_alphanumeric
  • to_lowercase

Source

View on GitHub

praisonai/src/parity/parse_utils.rs at line 26