1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#![no_std]
extern crate alloc;
pub use alloc::borrow::Cow;
mod advanpeekiter;
pub use advanpeekiter::{AdvanPeekIter, TakeWhile as APITakeWhile};
mod shard;
pub use shard::Shard;
mod shwsplit;
pub use shwsplit::{ShellwordSplitter, SyntaxError as SimpleSyntaxError};
fn get_offset_of<T>(whole_buffer: &T, part: &T) -> usize
where
    T: AsRef<[u8]> + ?Sized,
{
    
    
    
    part.as_ref().as_ptr() as usize - whole_buffer.as_ref().as_ptr() as usize
}
pub fn slice_between<'a>(whole_buffer_start: &'a [u8], post_part: &'a [u8]) -> &'a [u8] {
    debug_assert!(post_part.len() < whole_buffer_start.len());
    &whole_buffer_start[..get_offset_of(whole_buffer_start, post_part)]
}
pub fn split_at_while(x: &[u8], f: impl FnMut(&u8) -> bool) -> (&[u8], &[u8]) {
    x.split_at(x.iter().copied().take_while(f).count())
}