pub trait StrExt {
// Required methods
fn is_blank(&self) -> bool;
fn to_camel(&self) -> String;
fn to_snake(&self) -> String;
fn truncate(&self, max: usize) -> String;
fn random(len: usize) -> String;
// Provided method
fn has_text(&self) -> bool { ... }
}Expand description
字符串扩展 trait(为 &str 添加实用方法)
导入后可对任何字符串切片调用驼峰/蛇形互转、截断、判空、随机串等方法。
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.