Movatterモバイル変換


[0]ホーム

URL:


AsciiExt

std::ascii

TraitAsciiExt 

1.0.0 ·Source
pub trait AsciiExt {    typeOwned;    // Required methods    fnis_ascii(&self) ->bool;    fnto_ascii_uppercase(&self) -> Self::Owned;    fnto_ascii_lowercase(&self) -> Self::Owned;    fneq_ignore_ascii_case(&self, other: &Self) ->bool;    fnmake_ascii_uppercase(&mut self);    fnmake_ascii_lowercase(&mut self);}
👎Deprecated since 1.26.0: use inherent methods instead
Expand description

Extension methods for ASCII-subset only operations.

Be aware that operations on seemingly non-ASCII characters can sometimeshave unexpected results. Consider this example:

usestd::ascii::AsciiExt;assert_eq!(AsciiExt::to_ascii_uppercase("café"),"CAFÉ");assert_eq!(AsciiExt::to_ascii_uppercase("café"),"CAFé");

In the first example, the lowercased string is represented"cafe\u{301}"(the last character is an acute accentcombining character). Unlike theother characters in the string, the combining character will not get mappedto an uppercase variant, resulting in"CAFE\u{301}". In the secondexample, the lowercased string is represented"caf\u{e9}" (the lastcharacter is a single Unicode character representing an ‘e’ with an acuteaccent). Since the last character is defined outside the scope of ASCII,it will not get mapped to an uppercase variant, resulting in"CAF\u{e9}".

Required Associated Types§

1.0.0 ·Source

typeOwned

👎Deprecated since 1.26.0: use inherent methods instead

Container type for copied ASCII characters.

Required Methods§

1.0.0 ·Source

fnis_ascii(&self) ->bool

👎Deprecated since 1.26.0: use inherent methods instead

Checks if the value is within the ASCII range.

§Note

This method is deprecated in favor of the identically-namedinherent methods onu8,char,[u8] andstr.

1.0.0 ·Source

fnto_ascii_uppercase(&self) -> Self::Owned

👎Deprecated since 1.26.0: use inherent methods instead

Makes a copy of the value in its ASCII upper case equivalent.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’,but non-ASCII letters are unchanged.

To uppercase the value in-place, usemake_ascii_uppercase.

To uppercase ASCII characters in addition to non-ASCII characters, usestr::to_uppercase.

§Note

This method is deprecated in favor of the identically-namedinherent methods onu8,char,[u8] andstr.

1.0.0 ·Source

fnto_ascii_lowercase(&self) -> Self::Owned

👎Deprecated since 1.26.0: use inherent methods instead

Makes a copy of the value in its ASCII lower case equivalent.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’,but non-ASCII letters are unchanged.

To lowercase the value in-place, usemake_ascii_lowercase.

To lowercase ASCII characters in addition to non-ASCII characters, usestr::to_lowercase.

§Note

This method is deprecated in favor of the identically-namedinherent methods onu8,char,[u8] andstr.

1.0.0 ·Source

fneq_ignore_ascii_case(&self, other: &Self) ->bool

👎Deprecated since 1.26.0: use inherent methods instead

Checks that two values are an ASCII case-insensitive match.

Same asto_ascii_lowercase(a) == to_ascii_lowercase(b),but without allocating and copying temporaries.

§Note

This method is deprecated in favor of the identically-namedinherent methods onu8,char,[u8] andstr.

1.9.0 ·Source

fnmake_ascii_uppercase(&mut self)

👎Deprecated since 1.26.0: use inherent methods instead

Converts this type to its ASCII upper case equivalent in-place.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’,but non-ASCII letters are unchanged.

To return a new uppercased value without modifying the existing one, useto_ascii_uppercase.

§Note

This method is deprecated in favor of the identically-namedinherent methods onu8,char,[u8] andstr.

1.9.0 ·Source

fnmake_ascii_lowercase(&mut self)

👎Deprecated since 1.26.0: use inherent methods instead

Converts this type to its ASCII lower case equivalent in-place.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’,but non-ASCII letters are unchanged.

To return a new lowercased value without modifying the existing one, useto_ascii_lowercase.

§Note

This method is deprecated in favor of the identically-namedinherent methods onu8,char,[u8] andstr.

Dyn Compatibility§

This trait isnotdyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

1.0.0 ·Source§

implAsciiExt forchar

1.0.0 ·Source§

implAsciiExt forstr

1.0.0 ·Source§

implAsciiExt foru8

1.0.0 ·Source§

implAsciiExt for [u8]


[8]ページ先頭

©2009-2026 Movatter.jp