Skip to main content

value_bytes

Function value_bytes 

Source
pub fn value_bytes(arguments: &[OsString], value: OptionValue) -> &[u8] ⓘ
Expand description

What: The exact bytes of an option value. &[u8] borrows them from arguments. Why: Values are compared as bytes; converting to String would reject non-UTF-8 text.

In TS you’d write (pseudocode):

const text = 'offset' in value ? args[value.token].slice(value.offset) : args[value.token];