Expand description
This package allows you to efficiently search for hex patterns in the hex representation of Decodable values.
It is intended to find and search for these patterns in unix timestamps, specifically
occurences of DEAD
within the timestamp but is not limited to this.
use deadyet::{to_next_dead, to_next_pattern, has_pattern, Decodable};
assert_eq!(to_next_dead(0xDEAE), 0xFFFF);
assert_eq!(to_next_dead(0xDEACFF), 1);
assert_eq!(to_next_dead(0xDEAD0), 0);
assert_eq!(to_next_dead(0xDEAC0), 0x10);
assert_eq!(to_next_pattern(0xAAAAA, 0xABBA, 0xFFFF), 0x110);
assert!(has_pattern(0xAABBAA, 0xABBA));
Structs§
- Iterator to go through results of pattern search in order.
- Similar to PatternIterator, however efficiently describes ranges of pattern-truthness.
Traits§
- Implementors of this trait can be numerically expressed and reasonably mapped to a
Vec<u8>
of hex digits.
Functions§
- Creates a PatternRangeIterator for the pattern
DEAD
- Checks if
number
contains the hex pattern “DEAD”. - Checks whether or not the pattern of
pattern
is within the hex pattern ofnumber
. - Returns whether the current unix timecode contains a
DEAD
. - Returns the tuple (diff, abs) for the time until the next
DEAD
as well as the unix timestamp of that event. - Returns the number of seconds until the next
DEAD
in the unix timestamp. - Returns the time to the next dead ignoring the
lshd
least significant hex digits or 0 ifafter
already containsDEAD
. In the case that there can be noDEAD
after restricting the least significant bits, u64::MAX is returned. - Returns the different to the next greater occurrence of the pattern.
- Returns the difference to the next greater occurrence of the
pattern
in relation tonumber
.