Function Contains

Source
pub fn Contains(b: impl AsRef<[byte]>, subslice: impl AsRef<[byte]>) -> bool
Expand description

Contains reports whether subslice is within b.

zh-cn 判断切片b是否包含子切片subslice。

§Example

use gostd_bytes as bytes;

assert_eq!(true,bytes::Contains(b"seafood", b"foo"));
assert_eq!(false,bytes::Contains(b"seafood", b"bar"));
assert_eq!(true,bytes::Contains(b"seafood", b""));
assert_eq!(true,bytes::Contains(b"", b""));