warcat 0.3.0

Command-line tool and library for handling Web ARChive (WARC) files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::borrow::Cow;

pub fn to_ascii_uppercase_cow(text: &str) -> Cow<'_, str> {
    if text.chars().any(|c| c.is_ascii_lowercase()) {
        Cow::Owned(text.to_ascii_uppercase())
    } else {
        Cow::Borrowed(text)
    }
}

pub fn to_ascii_lowercase_cow(text: &str) -> Cow<'_, str> {
    if text.chars().any(|c| c.is_ascii_uppercase()) {
        Cow::Owned(text.to_ascii_lowercase())
    } else {
        Cow::Borrowed(text)
    }
}