pub fn add_str_item(mut self, context: &str, item: &str) -> UnicodeBuffer {
        const PANIC_MSG: &'static str = "`item` must be a substring of `context`";
        let offset =
            usize::checked_sub(item.as_ptr() as _, context.as_ptr() as _).expect(PANIC_MSG);
        assert!(offset + item.len() <= context.len(), PANIC_MSG);
        self.0.add_str_item(context, offset, item.len());
        self
    }
/// Add a string item to the buffer, providing context.
///
/// Only the `item` string gets added to the buffer and will be shaped.
/// `context` provides extra information to the shaper, allowing, for
/// example, to do cross-run Arabic shaping or properly handle combining
/// marks at the start of a run.
///
/// When shaping part of a larger text (e.g. a run of text from a paragraph)
/// you should pass the whole paragraph to this function as `context`
/// whereas `item` refers only to the part of the string to be shaped.
///
/// # Panics
///
/// Panics if `item` is not a substring of `context`. Note that `item` must
/// reside in the same allocation as `context`!
///
/// # Examples
///
/// We only want to shape the string `World` as part of the sentence `Hello
/// World!`.
///
/// ```
/// use harfbuzz_rs::UnicodeBuffer;
///
/// let string = "Hello World!";
///
/// // the range 6..11 corresponds to `World`
/// assert_eq!(&string[6..11], "World");
///
/// let buffer = UnicodeBuffer::new().add_str_item(string, &string[6..11]);
/// assert_eq!(buffer.string_lossy(), "World");
/// ```
Add a string item to the buffer, providing context.
Only the `item` string gets added to the buffer and will be shaped.
`context` provides extra information to the shaper, allowing, for
example, to do cross-run Arabic shaping or properly handle combining
marks at the start of a run.

When shaping part of a larger text
you should pass the whole paragraph to this function as `context`
whereas `item` refers only to the part of the string to be shaped.
Add a string item to the buffer providing context . Only the ` item ` string gets added to the buffer and will be shaped . ` context ` provides extra information to the shaper allowing for example to do cross - run Arabic shaping or properly handle combining marks at the start of a run . When shaping part of a larger text you should pass the whole paragraph to this function as ` context ` whereas ` item ` refers only to the part of the string to be shaped .
pub fn add_str_item(mut self, context: &str, item: &str) -> UnicodeBuffer {
        const PANIC_MSG: &'static str = "`item` must be a substring of `context`";
        let offset =
            usize::checked_sub(item.as_ptr() as _, context.as_ptr() as _).expect(PANIC_MSG);
        assert!(offset + item.len() <= context.len(), PANIC_MSG);
        self.0.add_str_item(context, offset, item.len());
        self
    }
pub fn add_str_item ( mut self , context : & str , item : & str ) -> UnicodeBuffer { const PANIC_MSG : & ' static str = " " ; let offset = usize :: checked_sub ( item . as_ptr ( ) as _ , context . as_ptr ( ) as _ ) . expect ( PANIC_MSG ) ; assert ! ( offset item len ( ) context len ( ) PANIC_MSG ) ; self . 0 . add_str_item ( context , offset , item . len ( ) ) ; self }
Add a string item to the buffer, providing context.
Add a string item to the buffer providing context .
mut self
context
&str
item
&str
mut self
context
&str
item
&str
panics
Panics if `item` is not a substring of `context`. Note that `item` must
reside in the same allocation as `context`!
Panics if ` item ` is not a substring of ` context ` . Note that ` item ` must reside in the same allocation as ` context ` !
examples
We only want to shape the string `World` as part of the sentence `Hello
World!`.

```
use harfbuzz_rs::UnicodeBuffer.

let string = "Hello World!".

the range 6..11 corresponds to `World`
assert_eq!(&string[6..11], "World").

let buffer = UnicodeBuffer::new().add_str_item(string, &string[6..11]);
assert_eq!(buffer.string_lossy(), "World");
```
We only want to shape the string ` World ` as part of the sentence ` Hello World! ` . ` ` ` use harfbuzz_rs :: UnicodeBuffer . let string = " Hello World! " . the range 6 .. 11 corresponds to ` World ` assert_eq! ( &string [ 6 .. 11 ] " World " ) . let buffer = UnicodeBuffer :: new () . add_str_item ( string &string [ 6 .. 11 ] ) ; assert_eq! ( buffer . string_lossy () " World " ) ; ` ` `