Function ldap3::dn_escape

source ·
pub fn dn_escape<'a, S: Into<Cow<'a, str>>>(val: S) -> Cow<'a, str>
Expand description

Escape an attribute value in a relative distinguished name (RDN).

When a literal string is used to represent an attribute value in an RDN, some of its characters might need to be escaped according to the rules of RFC 4514.

The function is named dn_escape() instead of rdn_escape() because of a long-standing association of its intended use with the handling of DNs.

The argument, val, can be owned or borrowed. The function doesn’t allocate the return value unless there’s need to escape the input.