miasma 0.4.1

Trap malicious AI web scrapers in an endless pit of poisoned training data.
Documentation
1
2
3
4
5
6
7
8
9
10
use std::borrow::Cow;

use bytes::Bytes;

pub fn as_bytes(cow: Cow<'static, str>) -> Bytes {
    match cow {
        Cow::Borrowed(s) => Bytes::from_static(s.as_bytes()),
        Cow::Owned(s) => Bytes::from(s.into_bytes()),
    }
}