Struct java_string::JavaString

source ·
pub struct JavaString { /* private fields */ }

Implementations§

source§

impl JavaString

source

pub fn from_modified_utf8(bytes: Vec<u8>) -> Result<JavaString, Utf8Error>

Converts from Java’s modified UTF-8 format to a JavaString.

See JavaStr::from_modified_utf8.

source

pub fn into_modified_utf8(self) -> Vec<u8>

Converts to Java’s modified UTF-8 format.

See JavaStr::to_modified_utf8.

source§

impl JavaString

source

pub const fn new() -> JavaString

source

pub fn with_capacity(capacity: usize) -> JavaString

source

pub fn from_full_utf8(vec: Vec<u8>) -> Result<JavaString, FromUtf8Error>

Converts vec to a JavaString if it is fully-valid UTF-8, i.e. UTF-8 without surrogate code points. See String::from_utf8.

source

pub fn from_semi_utf8(vec: Vec<u8>) -> Result<JavaString, FromUtf8Error>

Converts vec to a JavaString if it is semi-valid UTF-8, i.e. UTF-8 with surrogate code points.


assert_eq!(
    JavaString::from_semi_utf8(b"Hello World!".to_vec()).unwrap(),
    "Hello World!"
);
assert_eq!(
    JavaString::from_semi_utf8(vec![0xf0, 0x9f, 0x92, 0x96]).unwrap(),
    "💖"
);
assert_eq!(
    JavaString::from_semi_utf8(vec![0xed, 0xa0, 0x80]).unwrap(),
    JavaString::from(JavaCodePoint::from_u32(0xd800).unwrap())
);
assert!(JavaString::from_semi_utf8(vec![0xed]).is_err());
source

pub fn from_semi_utf8_lossy(v: &[u8]) -> Cow<'_, JavaStr>

Converts v to a Cow<JavaStr>, replacing invalid semi-UTF-8 with the replacement character �.


let sparkle_heart = [0xf0, 0x9f, 0x92, 0x96];
let result = JavaString::from_semi_utf8_lossy(&sparkle_heart);
assert!(matches!(result, Cow::Borrowed(_)));
assert_eq!(result, JavaStr::from_str("💖"));

let foobar_with_error = [b'f', b'o', b'o', 0xed, b'b', b'a', b'r'];
let result = JavaString::from_semi_utf8_lossy(&foobar_with_error);
assert!(matches!(result, Cow::Owned(_)));
assert_eq!(result, JavaStr::from_str("foo�bar"));
source

pub unsafe fn from_semi_utf8_unchecked(bytes: Vec<u8>) -> JavaString

§Safety

The parameter must be in semi-valid UTF-8 format, that is, UTF-8 plus surrogate code points.

source

pub fn into_bytes(self) -> Vec<u8>

source

pub fn as_java_str(&self) -> &JavaStr

source

pub fn as_mut_java_str(&mut self) -> &mut JavaStr

source

pub fn into_string(self) -> Result<String, Utf8Error>

Tries to convert this JavaString to a String, returning an error if it is not fully valid UTF-8, i.e. has no surrogate code points.


assert_eq!(
    JavaString::from("Hello World!").into_string().unwrap(),
    "Hello World!"
);
assert_eq!(
    JavaString::from("abc\0ℝ💣").into_string().unwrap(),
    "abc\0ℝ💣"
);

let string_with_error = JavaString::from("abc")
    + JavaString::from(JavaCodePoint::from_u32(0xd800).unwrap()).as_java_str();
assert!(string_with_error.into_string().is_err());
source

pub unsafe fn into_string_unchecked(self) -> String

§Safety

This string must be fully valid UTF-8, i.e. have no surrogate code points.

source

pub fn push_java_str(&mut self, string: &JavaStr)

source

pub fn push_str(&mut self, string: &str)

source

pub fn capacity(&self) -> usize

source

pub fn reserve(&mut self, additional: usize)

source

pub fn reserve_exact(&mut self, additional: usize)

source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

source

pub fn try_reserve_exact( &mut self, additional: usize, ) -> Result<(), TryReserveError>

source

pub fn shrink_to_fit(&mut self)

source

pub fn shrink_to(&mut self, min_capacity: usize)

source

pub fn push(&mut self, ch: char)

source

pub fn push_java(&mut self, ch: JavaCodePoint)

source

pub fn as_bytes(&self) -> &[u8]

source

pub fn truncate(&mut self, new_len: usize)

source

pub fn pop(&mut self) -> Option<JavaCodePoint>

See String::pop.


let mut str = JavaString::from("Hello World!");
assert_eq!(str.pop().unwrap(), '!');
assert_eq!(str, "Hello World");

let mut str = JavaString::from("東京");
assert_eq!(str.pop().unwrap(), '京');
assert_eq!(str, "東");

assert!(JavaString::new().pop().is_none());
source

pub fn remove(&mut self, idx: usize) -> JavaCodePoint

See String::remove.


let mut str = JavaString::from("Hello World!");
assert_eq!(str.remove(5), ' ');
assert_eq!(str, "HelloWorld!");

let mut str = JavaString::from("Hello 🦀 World!");
assert_eq!(str.remove(6), '🦀');
assert_eq!(str, "Hello  World!");
// Should panic
JavaString::new().remove(0);
// Should panic
JavaString::from("🦀").remove(1);
source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(JavaCodePoint) -> bool,

See String::retain.


let mut str = JavaString::from("Hello 🦀 World!");
str.retain(|ch| !ch.is_ascii_uppercase());
assert_eq!(str, "ello 🦀 orld!");
str.retain(JavaCodePoint::is_ascii);
assert_eq!(str, "ello  orld!");
source

pub fn insert(&mut self, idx: usize, ch: char)

See String::insert.

let mut s = JavaString::from("foo");
s.insert(3, 'a');
s.insert(4, 'r');
s.insert(3, 'b');
assert_eq!(s, "foobar");
source

pub fn insert_java(&mut self, idx: usize, ch: JavaCodePoint)

source

pub fn insert_str(&mut self, idx: usize, string: &str)

See String::insert_str.

let mut s = JavaString::from("bar");
s.insert_str(0, "foo");
assert_eq!(s, "foobar");
source

pub fn insert_java_str(&mut self, idx: usize, string: &JavaStr)

source

pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8>

See String::as_mut_vec.

§Safety

The returned Vec must not have invalid UTF-8 written to it, besides surrogate pairs.

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn split_off(&mut self, at: usize) -> JavaString

See String::split_off.

let mut hello = JavaString::from("Hello World!");
let world = hello.split_off(6);
assert_eq!(hello, "Hello ");
assert_eq!(world, "World!");
let mut s = JavaString::from("🦀");
// Should panic
let _ = s.split_off(1);
source

pub fn clear(&mut self)

source

pub fn drain<R>(&mut self, range: R) -> Drain<'_>
where R: RangeBounds<usize>,

See String::drain.


let mut s = JavaString::from("α is alpha, β is beta");
let beta_offset = s.find('β').unwrap_or(s.len());

// Remove the range up until the β from the string
let t: JavaString = s.drain(..beta_offset).collect();
assert_eq!(t, "α is alpha, ");
assert_eq!(s, "β is beta");

// A full range clears the string, like `clear()` does
s.drain(..);
assert_eq!(s, "");
source

pub fn replace_range<R>(&mut self, range: R, replace_with: &str)
where R: RangeBounds<usize>,

See String::replace_range.


let mut s = JavaString::from("α is alpha, β is beta");
let beta_offset = s.find('β').unwrap_or(s.len());

// Replace the range up until the β from the string
s.replace_range(..beta_offset, "Α is capital alpha; ");
assert_eq!(s, "Α is capital alpha; β is beta");
let mut s = JavaString::from("α is alpha, β is beta");
// Should panic
s.replace_range(..1, "Α is capital alpha; ");
source

pub fn replace_range_java<R>(&mut self, range: R, replace_with: &JavaStr)
where R: RangeBounds<usize>,

source

pub fn into_boxed_str(self) -> Box<JavaStr>

source

pub fn leak<'a>(self) -> &'a mut JavaStr

Methods from Deref<Target = JavaStr>§

source

pub fn to_modified_utf8(&self) -> Cow<'_, [u8]>

Converts to Java’s modified UTF-8 format.


let result = JavaStr::from_str("Hello World!").to_modified_utf8();
assert!(matches!(result, Cow::Borrowed(_)));
assert_eq!(result, &b"Hello World!"[..]);

let mut str = JavaString::from("abc\0ℝ💣");
str.push_java(JavaCodePoint::from_u32(0xd800).unwrap());
let result = str.to_modified_utf8();
let expected = [
    0x61, 0x62, 0x63, 0xc0, 0x80, 0xe2, 0x84, 0x9d, 0xed, 0xa0, 0xbd, 0xed, 0xb2, 0xa3, 0xed,
    0xa0, 0x80,
];
assert!(matches!(result, Cow::Owned(_)));
assert_eq!(result, &expected[..]);
source

pub fn as_bytes(&self) -> &[u8]

source

pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8]

See str::as_bytes_mut.

§Safety

The returned slice must not have invalid UTF-8 written to it, besides surrogate pairs.

source

pub fn as_mut_ptr(&mut self) -> *mut u8

source

pub fn as_ptr(&self) -> *const u8

source

pub fn as_str(&self) -> Result<&str, Utf8Error>

Tries to convert this &JavaStr to a &str, returning an error if it is not fully valid UTF-8, i.e. has no surrogate code points.

source

pub unsafe fn as_str_unchecked(&self) -> &str

§Safety

This string must be fully valid UTF-8, i.e. have no surrogate code points.

source

pub fn as_str_lossy(&self) -> Cow<'_, str>

Converts this &JavaStr to a Cow<str>, replacing surrogate code points with the replacement character �.

let s = JavaStr::from_str("Hello 🦀 World!");
let result = s.as_str_lossy();
assert!(matches!(result, Cow::Borrowed(_)));
assert_eq!(result, "Hello 🦀 World!");

let s = JavaString::from("Hello ")
    + JavaString::from(JavaCodePoint::from_u32(0xd800).unwrap()).as_java_str()
    + JavaStr::from_str(" World!");
let result = s.as_str_lossy();
assert!(matches!(result, Cow::Owned(_)));
assert_eq!(result, "Hello � World!");
source

pub fn bytes(&self) -> Bytes<'_>

source

pub fn char_indices(&self) -> CharIndices<'_>

source

pub fn chars(&self) -> Chars<'_>

source

pub fn contains<P>(&self, pat: P) -> bool
where P: JavaStrPattern,

See str::contains.

let bananas = JavaStr::from_str("bananas");

assert!(bananas.contains("nana"));
assert!(!bananas.contains("apples"));
source

pub fn ends_with<P>(&self, pat: P) -> bool
where P: JavaStrPattern,

See str::ends_with.

let bananas = JavaStr::from_str("bananas");

assert!(bananas.ends_with("anas"));
assert!(!bananas.ends_with("nana"));
source

pub fn eq_ignore_ascii_case(&self, other: &str) -> bool

source

pub fn eq_java_ignore_ascii_case(&self, other: &JavaStr) -> bool

source

pub fn escape_debug(&self) -> EscapeDebug<'_>

See str::escape_debug.

assert_eq!(
    JavaStr::from_str("❤\n!").escape_debug().to_string(),
    "❤\\n!"
);
source

pub fn escape_default(&self) -> EscapeDefault<'_>

See str::escape_default.

assert_eq!(
    JavaStr::from_str("❤\n!").escape_default().to_string(),
    "\\u{2764}\\n!"
);
source

pub fn escape_unicode(&self) -> EscapeUnicode<'_>

See str::escape_unicode.

assert_eq!(
    JavaStr::from_str("❤\n!").escape_unicode().to_string(),
    "\\u{2764}\\u{a}\\u{21}"
);
source

pub fn find<P>(&self, pat: P) -> Option<usize>
where P: JavaStrPattern,

See str::find.

let s = "Löwe 老虎 Léopard Gepardi";

assert_eq!(s.find('L'), Some(0));
assert_eq!(s.find('é'), Some(14));
assert_eq!(s.find("par"), Some(17));

let x: &[_] = &['1', '2'];
assert_eq!(s.find(x), None);
source

pub fn get<I>(&self, i: I) -> Option<&JavaStr>

See str::get.

let v = JavaString::from("🗻∈🌏");

assert_eq!(Some(JavaStr::from_str("🗻")), v.get(0..4));

// indices not on UTF-8 sequence boundaries
assert!(v.get(1..).is_none());
assert!(v.get(..8).is_none());

// out of bounds
assert!(v.get(..42).is_none());
source

pub fn get_mut<I>(&mut self, i: I) -> Option<&mut JavaStr>

source

pub unsafe fn get_unchecked<I>(&self, i: I) -> &JavaStr

See str::get_unchecked.

§Safety
  • The starting index must not exceed the ending index
  • Indexes must be within bounds of the original slice
  • Indexes must lie on UTF-8 sequence boundaries
source

pub unsafe fn get_unchecked_mut<I>(&mut self, i: I) -> &mut JavaStr

See str::get_unchecked_mut.

§Safety
  • The starting index must not exceed the ending index
  • Indexes must be within bounds of the original slice
  • Indexes must lie on UTF-8 sequence boundaries
source

pub fn is_ascii(&self) -> bool

source

pub fn is_char_boundary(&self, index: usize) -> bool

source

pub fn is_empty(&self) -> bool

source

pub fn len(&self) -> usize

See str::len.

source

pub fn lines(&self) -> Lines<'_>

source

pub fn make_ascii_lowercase(&mut self)

source

pub fn make_ascii_uppercase(&mut self)

source

pub fn match_indices<P>(&self, pat: P) -> MatchIndices<'_, P>
where P: JavaStrPattern,

See str::match_indices.

let v: Vec<_> = JavaStr::from_str("abcXXXabcYYYabc")
    .match_indices("abc")
    .collect();
assert_eq!(
    v,
    [
        (0, JavaStr::from_str("abc")),
        (6, JavaStr::from_str("abc")),
        (12, JavaStr::from_str("abc"))
    ]
);

let v: Vec<_> = JavaStr::from_str("1abcabc2").match_indices("abc").collect();
assert_eq!(
    v,
    [(1, JavaStr::from_str("abc")), (4, JavaStr::from_str("abc"))]
);

let v: Vec<_> = JavaStr::from_str("ababa").match_indices("aba").collect();
assert_eq!(v, [(0, JavaStr::from_str("aba"))]); // only the first `aba`
source

pub fn matches<P>(&self, pat: P) -> Matches<'_, P>
where P: JavaStrPattern,

See str::matches.

let v: Vec<&JavaStr> = JavaStr::from_str("abcXXXabcYYYabc")
    .matches("abc")
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("abc"),
        JavaStr::from_str("abc"),
        JavaStr::from_str("abc")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("1abc2abc3")
    .matches(JavaCodePoint::is_numeric)
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("1"),
        JavaStr::from_str("2"),
        JavaStr::from_str("3")
    ]
);
source

pub fn parse<F>(&self) -> Result<F, ParseError<<F as FromStr>::Err>>
where F: FromStr,

source

pub fn repeat(&self, n: usize) -> JavaString

source

pub fn replace<P>(&self, from: P, to: &str) -> JavaString
where P: JavaStrPattern,

See str::replace.

let s = JavaStr::from_str("this is old");

assert_eq!("this is new", s.replace("old", "new"));
assert_eq!("than an old", s.replace("is", "an"));
source

pub fn replace_java<P>(&self, from: P, to: &JavaStr) -> JavaString
where P: JavaStrPattern,

source

pub fn replacen<P>(&self, from: P, to: &str, count: usize) -> JavaString
where P: JavaStrPattern,

See str::replacen.

let s = JavaStr::from_str("foo foo 123 foo");
assert_eq!("new new 123 foo", s.replacen("foo", "new", 2));
assert_eq!("faa fao 123 foo", s.replacen('o', "a", 3));
assert_eq!(
    "foo foo new23 foo",
    s.replacen(JavaCodePoint::is_numeric, "new", 1)
);
source

pub fn replacen_java<P>( &self, from: P, to: &JavaStr, count: usize, ) -> JavaString
where P: JavaStrPattern,

source

pub fn rfind<P>(&self, pat: P) -> Option<usize>
where P: JavaStrPattern,

See str::rfind.

let s = JavaStr::from_str("Löwe 老虎 Léopard Gepardi");

assert_eq!(s.rfind('L'), Some(13));
assert_eq!(s.rfind('é'), Some(14));
assert_eq!(s.rfind("par"), Some(24));

let x: &[_] = &['1', '2'];
assert_eq!(s.rfind(x), None);
source

pub fn rmatch_indices<P>(&self, pat: P) -> RMatchIndices<'_, P>
where P: JavaStrPattern,

See str::rmatch_indices.

let v: Vec<_> = JavaStr::from_str("abcXXXabcYYYabc")
    .rmatch_indices("abc")
    .collect();
assert_eq!(
    v,
    [
        (12, JavaStr::from_str("abc")),
        (6, JavaStr::from_str("abc")),
        (0, JavaStr::from_str("abc"))
    ]
);

let v: Vec<_> = JavaStr::from_str("1abcabc2")
    .rmatch_indices("abc")
    .collect();
assert_eq!(
    v,
    [(4, JavaStr::from_str("abc")), (1, JavaStr::from_str("abc"))]
);

let v: Vec<_> = JavaStr::from_str("ababa").rmatch_indices("aba").collect();
assert_eq!(v, [(2, JavaStr::from_str("aba"))]); // only the last `aba`
source

pub fn rmatches<P>(&self, pat: P) -> RMatches<'_, P>
where P: JavaStrPattern,

See str::rmatches.

let v: Vec<&JavaStr> = JavaStr::from_str("abcXXXabcYYYabc")
    .rmatches("abc")
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("abc"),
        JavaStr::from_str("abc"),
        JavaStr::from_str("abc")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("1abc2abc3")
    .rmatches(JavaCodePoint::is_numeric)
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("3"),
        JavaStr::from_str("2"),
        JavaStr::from_str("1")
    ]
);
source

pub fn rsplit<P>(&self, pat: P) -> RSplit<'_, P>
where P: JavaStrPattern,

See str::rsplit.

let v: Vec<&JavaStr> = JavaStr::from_str("Mary had a little lamb")
    .rsplit(' ')
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("lamb"),
        JavaStr::from_str("little"),
        JavaStr::from_str("a"),
        JavaStr::from_str("had"),
        JavaStr::from_str("Mary")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("").rsplit('X').collect();
assert_eq!(v, [JavaStr::from_str("")]);

let v: Vec<&JavaStr> = JavaStr::from_str("lionXXtigerXleopard")
    .rsplit('X')
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("leopard"),
        JavaStr::from_str("tiger"),
        JavaStr::from_str(""),
        JavaStr::from_str("lion")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("lion::tiger::leopard")
    .rsplit("::")
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("leopard"),
        JavaStr::from_str("tiger"),
        JavaStr::from_str("lion")
    ]
);
source

pub fn rsplit_once<P>(&self, delimiter: P) -> Option<(&JavaStr, &JavaStr)>
where P: JavaStrPattern,

See str::rsplit_once.

assert_eq!(JavaStr::from_str("cfg").rsplit_once('='), None);
assert_eq!(
    JavaStr::from_str("cfg=foo").rsplit_once('='),
    Some((JavaStr::from_str("cfg"), JavaStr::from_str("foo")))
);
assert_eq!(
    JavaStr::from_str("cfg=foo=bar").rsplit_once('='),
    Some((JavaStr::from_str("cfg=foo"), JavaStr::from_str("bar")))
);
source

pub fn rsplit_terminator<P>(&self, pat: P) -> RSplitTerminator<'_, P>
where P: JavaStrPattern,

See str::rsplit_terminator.

let v: Vec<&JavaStr> = JavaStr::from_str("A.B.").rsplit_terminator('.').collect();
assert_eq!(v, [JavaStr::from_str("B"), JavaStr::from_str("A")]);

let v: Vec<&JavaStr> = JavaStr::from_str("A..B..").rsplit_terminator(".").collect();
assert_eq!(
    v,
    [
        JavaStr::from_str(""),
        JavaStr::from_str("B"),
        JavaStr::from_str(""),
        JavaStr::from_str("A")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("A.B:C.D")
    .rsplit_terminator(&['.', ':'][..])
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("D"),
        JavaStr::from_str("C"),
        JavaStr::from_str("B"),
        JavaStr::from_str("A")
    ]
);
source

pub fn rsplitn<P>(&self, n: usize, pat: P) -> RSplitN<'_, P>
where P: JavaStrPattern,

See str::rsplitn.

let v: Vec<&JavaStr> = JavaStr::from_str("Mary had a little lamb")
    .rsplitn(3, ' ')
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("lamb"),
        JavaStr::from_str("little"),
        JavaStr::from_str("Mary had a")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("lionXXtigerXleopard")
    .rsplitn(3, 'X')
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("leopard"),
        JavaStr::from_str("tiger"),
        JavaStr::from_str("lionX")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("lion::tiger::leopard")
    .rsplitn(2, "::")
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("leopard"),
        JavaStr::from_str("lion::tiger")
    ]
);
source

pub fn split<P>(&self, pat: P) -> Split<'_, P>
where P: JavaStrPattern,

See str::split.

let v: Vec<&JavaStr> = JavaStr::from_str("Mary had a little lamb")
    .split(' ')
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("Mary"),
        JavaStr::from_str("had"),
        JavaStr::from_str("a"),
        JavaStr::from_str("little"),
        JavaStr::from_str("lamb")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("").split('X').collect();
assert_eq!(v, [JavaStr::from_str("")]);

let v: Vec<&JavaStr> = JavaStr::from_str("lionXXtigerXleopard")
    .split('X')
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("lion"),
        JavaStr::from_str(""),
        JavaStr::from_str("tiger"),
        JavaStr::from_str("leopard")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("lion::tiger::leopard")
    .split("::")
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("lion"),
        JavaStr::from_str("tiger"),
        JavaStr::from_str("leopard")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("abc1def2ghi")
    .split(JavaCodePoint::is_numeric)
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("abc"),
        JavaStr::from_str("def"),
        JavaStr::from_str("ghi")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("lionXtigerXleopard")
    .split(JavaCodePoint::is_uppercase)
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("lion"),
        JavaStr::from_str("tiger"),
        JavaStr::from_str("leopard")
    ]
);
source

pub fn split_ascii_whitespace(&self) -> SplitAsciiWhitespace<'_>

See str::split_ascii_whitespace.

let mut iter = JavaStr::from_str(" Mary   had\ta little  \n\t lamb").split_ascii_whitespace();
assert_eq!(Some(JavaStr::from_str("Mary")), iter.next());
assert_eq!(Some(JavaStr::from_str("had")), iter.next());
assert_eq!(Some(JavaStr::from_str("a")), iter.next());
assert_eq!(Some(JavaStr::from_str("little")), iter.next());
assert_eq!(Some(JavaStr::from_str("lamb")), iter.next());

assert_eq!(None, iter.next());
source

pub fn split_at(&self, mid: usize) -> (&JavaStr, &JavaStr)

See str::split_at.

let s = JavaStr::from_str("Per Martin-Löf");

let (first, last) = s.split_at(3);

assert_eq!("Per", first);
assert_eq!(" Martin-Löf", last);
let s = JavaStr::from_str("Per Martin-Löf");
// Should panic
let _ = s.split_at(13);
source

pub fn split_at_mut(&mut self, mid: usize) -> (&mut JavaStr, &mut JavaStr)

See str::split_at_mut.

let mut s = JavaString::from("Per Martin-Löf");
let s = s.as_mut_java_str();

let (first, last) = s.split_at_mut(3);

assert_eq!("Per", first);
assert_eq!(" Martin-Löf", last);
let mut s = JavaString::from("Per Martin-Löf");
let s = s.as_mut_java_str();
// Should panic
let _ = s.split_at(13);
source

pub fn split_inclusive<P>(&self, pat: P) -> SplitInclusive<'_, P>
where P: JavaStrPattern,

See str::split_inclusive.

let v: Vec<&JavaStr> = JavaStr::from_str("Mary had a little lamb\nlittle lamb\nlittle lamb.\n")
    .split_inclusive('\n')
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("Mary had a little lamb\n"),
        JavaStr::from_str("little lamb\n"),
        JavaStr::from_str("little lamb.\n")
    ]
);
source

pub fn split_once<P>(&self, delimiter: P) -> Option<(&JavaStr, &JavaStr)>
where P: JavaStrPattern,

See str::split_once.

assert_eq!(JavaStr::from_str("cfg").split_once('='), None);
assert_eq!(
    JavaStr::from_str("cfg=").split_once('='),
    Some((JavaStr::from_str("cfg"), JavaStr::from_str("")))
);
assert_eq!(
    JavaStr::from_str("cfg=foo").split_once('='),
    Some((JavaStr::from_str("cfg"), JavaStr::from_str("foo")))
);
assert_eq!(
    JavaStr::from_str("cfg=foo=bar").split_once('='),
    Some((JavaStr::from_str("cfg"), JavaStr::from_str("foo=bar")))
);
source

pub fn split_terminator<P>(&self, pat: P) -> SplitTerminator<'_, P>
where P: JavaStrPattern,

See str::split_terminator.

let v: Vec<&JavaStr> = JavaStr::from_str("A.B.").split_terminator('.').collect();
assert_eq!(v, [JavaStr::from_str("A"), JavaStr::from_str("B")]);

let v: Vec<&JavaStr> = JavaStr::from_str("A..B..").split_terminator(".").collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("A"),
        JavaStr::from_str(""),
        JavaStr::from_str("B"),
        JavaStr::from_str("")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("A.B:C.D")
    .split_terminator(&['.', ':'][..])
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("A"),
        JavaStr::from_str("B"),
        JavaStr::from_str("C"),
        JavaStr::from_str("D")
    ]
);
source

pub fn split_whitespace(&self) -> SplitWhitespace<'_>

source

pub fn splitn<P>(&self, n: usize, pat: P) -> SplitN<'_, P>
where P: JavaStrPattern,

See str::splitn.

let v: Vec<&JavaStr> = JavaStr::from_str("Mary had a little lambda")
    .splitn(3, ' ')
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("Mary"),
        JavaStr::from_str("had"),
        JavaStr::from_str("a little lambda")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("lionXXtigerXleopard")
    .splitn(3, "X")
    .collect();
assert_eq!(
    v,
    [
        JavaStr::from_str("lion"),
        JavaStr::from_str(""),
        JavaStr::from_str("tigerXleopard")
    ]
);

let v: Vec<&JavaStr> = JavaStr::from_str("abcXdef").splitn(1, 'X').collect();
assert_eq!(v, [JavaStr::from_str("abcXdef")]);

let v: Vec<&JavaStr> = JavaStr::from_str("").splitn(1, 'X').collect();
assert_eq!(v, [JavaStr::from_str("")]);
source

pub fn starts_with<P>(&self, pat: P) -> bool
where P: JavaStrPattern,

See str::starts_with.

let bananas = JavaStr::from_str("bananas");

assert!(bananas.starts_with("bana"));
assert!(!bananas.starts_with("nana"));
source

pub fn strip_prefix<P>(&self, prefix: P) -> Option<&JavaStr>
where P: JavaStrPattern,

See str::strip_prefix.

assert_eq!(
    JavaStr::from_str("foo:bar").strip_prefix("foo:"),
    Some(JavaStr::from_str("bar"))
);
assert_eq!(JavaStr::from_str("foo:bar").strip_prefix("bar"), None);
assert_eq!(
    JavaStr::from_str("foofoo").strip_prefix("foo"),
    Some(JavaStr::from_str("foo"))
);
source

pub fn strip_suffix<P>(&self, suffix: P) -> Option<&JavaStr>
where P: JavaStrPattern,

See str::strip_suffix.

assert_eq!(
    JavaStr::from_str("bar:foo").strip_suffix(":foo"),
    Some(JavaStr::from_str("bar"))
);
assert_eq!(JavaStr::from_str("bar:foo").strip_suffix("bar"), None);
assert_eq!(
    JavaStr::from_str("foofoo").strip_suffix("foo"),
    Some(JavaStr::from_str("foo"))
);
source

pub fn to_ascii_lowercase(&self) -> JavaString

source

pub fn to_ascii_uppercase(&self) -> JavaString

source

pub fn to_lowercase(&self) -> JavaString

See str::to_lowercase.

let s = JavaStr::from_str("HELLO");
assert_eq!("hello", s.to_lowercase());

let odysseus = JavaStr::from_str("ὈΔΥΣΣΕΎΣ");
assert_eq!("ὀδυσσεύς", odysseus.to_lowercase());

let s = JavaString::from("Hello ")
    + JavaString::from(JavaCodePoint::from_u32(0xd800).unwrap()).as_java_str()
    + JavaStr::from_str(" World!");
let expected = JavaString::from("hello ")
    + JavaString::from(JavaCodePoint::from_u32(0xd800).unwrap()).as_java_str()
    + JavaStr::from_str(" world!");
assert_eq!(expected, s.to_lowercase());
source

pub fn to_uppercase(&self) -> JavaString

See str::to_uppercase.

let s = JavaStr::from_str("hello");
assert_eq!("HELLO", s.to_uppercase());

let s = JavaStr::from_str("tschüß");
assert_eq!("TSCHÜSS", s.to_uppercase());

let s = JavaString::from("Hello ")
    + JavaString::from(JavaCodePoint::from_u32(0xd800).unwrap()).as_java_str()
    + JavaStr::from_str(" World!");
let expected = JavaString::from("HELLO ")
    + JavaString::from(JavaCodePoint::from_u32(0xd800).unwrap()).as_java_str()
    + JavaStr::from_str(" WORLD!");
assert_eq!(expected, s.to_uppercase());
source

pub fn trim(&self) -> &JavaStr

See str::trim.

source

pub fn trim_end(&self) -> &JavaStr

source

pub fn trim_end_matches<P>(&self, pat: P) -> &JavaStr
where P: JavaStrPattern,

See str::trim_end_matches.

assert_eq!(
    JavaStr::from_str("11foo1bar11").trim_end_matches('1'),
    "11foo1bar"
);
assert_eq!(
    JavaStr::from_str("123foo1bar123").trim_end_matches(JavaCodePoint::is_numeric),
    "123foo1bar"
);

let x: &[_] = &['1', '2'];
assert_eq!(
    JavaStr::from_str("12foo1bar12").trim_end_matches(x),
    "12foo1bar"
);
source

pub fn trim_matches<P>(&self, pat: P) -> &JavaStr
where P: JavaStrPattern,

See str::trim_matches.

assert_eq!(
    JavaStr::from_str("11foo1bar11").trim_matches('1'),
    "foo1bar"
);
assert_eq!(
    JavaStr::from_str("123foo1bar123").trim_matches(JavaCodePoint::is_numeric),
    "foo1bar"
);

let x: &[_] = &['1', '2'];
assert_eq!(JavaStr::from_str("12foo1bar12").trim_matches(x), "foo1bar");
source

pub fn trim_start(&self) -> &JavaStr

source

pub fn trim_start_matches<P>(&self, pat: P) -> &JavaStr
where P: JavaStrPattern,

See str::trim_start_matches.

assert_eq!(
    JavaStr::from_str("11foo1bar11").trim_start_matches('1'),
    "foo1bar11"
);
assert_eq!(
    JavaStr::from_str("123foo1bar123").trim_start_matches(JavaCodePoint::is_numeric),
    "foo1bar123"
);

let x: &[_] = &['1', '2'];
assert_eq!(
    JavaStr::from_str("12foo1bar12").trim_start_matches(x),
    "foo1bar12"
);

Trait Implementations§

source§

impl Add<&JavaStr> for JavaString

source§

type Output = JavaString

The resulting type after applying the + operator.
source§

fn add(self, rhs: &JavaStr) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&str> for JavaString

source§

type Output = JavaString

The resulting type after applying the + operator.
source§

fn add(self, rhs: &str) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<&JavaStr> for JavaString

source§

fn add_assign(&mut self, rhs: &JavaStr)

Performs the += operation. Read more
source§

impl AddAssign<&str> for JavaString

source§

fn add_assign(&mut self, rhs: &str)

Performs the += operation. Read more
source§

impl AsMut<JavaStr> for JavaString

source§

fn as_mut(&mut self) -> &mut JavaStr

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[u8]> for JavaString

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<JavaStr> for JavaString

source§

fn as_ref(&self) -> &JavaStr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<JavaStr> for JavaString

source§

fn borrow(&self) -> &JavaStr

Immutably borrows from an owned value. Read more
source§

impl BorrowMut<JavaStr> for JavaString

source§

fn borrow_mut(&mut self) -> &mut JavaStr

Mutably borrows from an owned value. Read more
source§

impl Clone for JavaString

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for JavaString

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for JavaString

source§

fn default() -> JavaString

Returns the “default value” for a type. Read more
source§

impl Deref for JavaString

source§

type Target = JavaStr

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for JavaString

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'de> Deserialize<'de> for JavaString

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for JavaString

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Extend<&'a JavaCodePoint> for JavaString

source§

fn extend<T: IntoIterator<Item = &'a JavaCodePoint>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<'a> Extend<&'a JavaStr> for JavaString

source§

fn extend<T: IntoIterator<Item = &'a JavaStr>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<'a> Extend<&'a char> for JavaString

source§

fn extend<T: IntoIterator<Item = &'a char>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<'a> Extend<&'a str> for JavaString

source§

fn extend<T: IntoIterator<Item = &'a str>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<Box<JavaStr>> for JavaString

source§

fn extend<T: IntoIterator<Item = Box<JavaStr>>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<Box<str>> for JavaString

source§

fn extend<T: IntoIterator<Item = Box<str>>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<'a> Extend<Cow<'a, JavaStr>> for JavaString

source§

fn extend<T: IntoIterator<Item = Cow<'a, JavaStr>>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<'a> Extend<Cow<'a, str>> for JavaString

source§

fn extend<T: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<JavaCodePoint> for JavaString

source§

fn extend<T: IntoIterator<Item = JavaCodePoint>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<JavaString> for JavaString

source§

fn extend<T: IntoIterator<Item = JavaString>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<String> for JavaString

source§

fn extend<T: IntoIterator<Item = String>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<char> for JavaString

source§

fn extend<T: IntoIterator<Item = char>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl From<&JavaStr> for JavaString

source§

fn from(value: &JavaStr) -> Self

Converts to this type from the input type.
source§

impl From<&JavaString> for JavaString

source§

fn from(value: &JavaString) -> Self

Converts to this type from the input type.
source§

impl From<&String> for JavaString

source§

fn from(value: &String) -> Self

Converts to this type from the input type.
source§

impl From<&mut JavaStr> for JavaString

source§

fn from(value: &mut JavaStr) -> Self

Converts to this type from the input type.
source§

impl From<&mut str> for JavaString

source§

fn from(value: &mut str) -> Self

Converts to this type from the input type.
source§

impl From<&str> for JavaString

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl From<Box<JavaStr>> for JavaString

source§

fn from(value: Box<JavaStr>) -> Self

Converts to this type from the input type.
source§

impl From<Box<str>> for JavaString

source§

fn from(value: Box<str>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Cow<'a, JavaStr>> for JavaString

source§

fn from(value: Cow<'a, JavaStr>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Cow<'a, str>> for JavaString

source§

fn from(value: Cow<'a, str>) -> Self

Converts to this type from the input type.
source§

impl From<JavaCodePoint> for JavaString

source§

fn from(value: JavaCodePoint) -> Self

Converts to this type from the input type.
source§

impl From<JavaString> for Arc<JavaStr>

source§

fn from(value: JavaString) -> Self

Converts to this type from the input type.
source§

impl From<JavaString> for Box<JavaStr>

source§

fn from(value: JavaString) -> Self

Converts to this type from the input type.
source§

impl<'a> From<JavaString> for Cow<'a, JavaStr>

source§

fn from(value: JavaString) -> Self

Converts to this type from the input type.
source§

impl From<JavaString> for Rc<JavaStr>

source§

fn from(value: JavaString) -> Self

Converts to this type from the input type.
source§

impl From<JavaString> for Vec<u8>

source§

fn from(value: JavaString) -> Self

Converts to this type from the input type.
source§

impl From<String> for JavaString

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<char> for JavaString

source§

fn from(value: char) -> Self

Converts to this type from the input type.
source§

impl<'a> FromIterator<&'a JavaCodePoint> for JavaString

source§

fn from_iter<T: IntoIterator<Item = &'a JavaCodePoint>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> FromIterator<&'a char> for JavaString

source§

fn from_iter<T: IntoIterator<Item = &'a char>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> FromIterator<&'a str> for JavaString

source§

fn from_iter<T: IntoIterator<Item = &'a str>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<Box<JavaStr>> for JavaString

source§

fn from_iter<T: IntoIterator<Item = Box<JavaStr>>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<Box<str>> for JavaString

source§

fn from_iter<T: IntoIterator<Item = Box<str>>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> FromIterator<Cow<'a, JavaStr>> for JavaString

source§

fn from_iter<T: IntoIterator<Item = Cow<'a, JavaStr>>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> FromIterator<Cow<'a, str>> for JavaString

source§

fn from_iter<T: IntoIterator<Item = Cow<'a, str>>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<JavaCodePoint> for JavaString

source§

fn from_iter<T: IntoIterator<Item = JavaCodePoint>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<JavaString> for JavaString

source§

fn from_iter<T: IntoIterator<Item = JavaString>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<String> for JavaString

source§

fn from_iter<T: IntoIterator<Item = String>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<char> for JavaString

source§

fn from_iter<T: IntoIterator<Item = char>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromStr for JavaString

source§

type Err = Infallible

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for JavaString

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Index<Range<usize>> for JavaString

source§

type Output = JavaStr

The returned type after indexing.
source§

fn index(&self, index: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeFrom<usize>> for JavaString

source§

type Output = JavaStr

The returned type after indexing.
source§

fn index(&self, index: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeFull> for JavaString

source§

type Output = JavaStr

The returned type after indexing.
source§

fn index(&self, _index: RangeFull) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeInclusive<usize>> for JavaString

source§

type Output = JavaStr

The returned type after indexing.
source§

fn index(&self, index: RangeInclusive<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeTo<usize>> for JavaString

source§

type Output = JavaStr

The returned type after indexing.
source§

fn index(&self, index: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<RangeToInclusive<usize>> for JavaString

source§

type Output = JavaStr

The returned type after indexing.
source§

fn index(&self, index: RangeToInclusive<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<Range<usize>> for JavaString

source§

fn index_mut(&mut self, index: Range<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeFrom<usize>> for JavaString

source§

fn index_mut(&mut self, index: RangeFrom<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeFull> for JavaString

source§

fn index_mut(&mut self, _index: RangeFull) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeInclusive<usize>> for JavaString

source§

fn index_mut(&mut self, index: RangeInclusive<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeTo<usize>> for JavaString

source§

fn index_mut(&mut self, index: RangeTo<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<RangeToInclusive<usize>> for JavaString

source§

fn index_mut(&mut self, index: RangeToInclusive<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl Ord for JavaString

source§

fn cmp(&self, other: &JavaString) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<'a> PartialEq<&'a JavaStr> for JavaString

source§

fn eq(&self, other: &&'a JavaStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<&'a str> for JavaString

source§

fn eq(&self, other: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<Cow<'a, JavaStr>> for JavaString

source§

fn eq(&self, other: &Cow<'a, JavaStr>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<Cow<'a, str>> for JavaString

source§

fn eq(&self, other: &Cow<'a, str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<JavaStr> for JavaString

source§

fn eq(&self, other: &JavaStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<JavaString> for &'a JavaStr

source§

fn eq(&self, other: &JavaString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<JavaString> for &'a str

source§

fn eq(&self, other: &JavaString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<JavaString> for Cow<'a, JavaStr>

source§

fn eq(&self, other: &JavaString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<JavaString> for Cow<'a, str>

source§

fn eq(&self, other: &JavaString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<JavaString> for JavaStr

source§

fn eq(&self, other: &JavaString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<JavaString> for String

source§

fn eq(&self, other: &JavaString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<JavaString> for str

source§

fn eq(&self, other: &JavaString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<String> for JavaString

source§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<str> for JavaString

source§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for JavaString

source§

fn eq(&self, other: &JavaString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for JavaString

source§

fn partial_cmp(&self, other: &JavaString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for JavaString

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Write for JavaString

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
source§

fn write_char(&mut self, c: char) -> Result

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
source§

impl Eq for JavaString

source§

impl StructuralPartialEq for JavaString

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,