Skip to main content

insert_tokens

Function insert_tokens 

Source
pub fn insert_tokens(
    arguments: &[OsString],
    at: usize,
    inserted: &[&str],
) -> Vec<OsString>
Expand description

What: Copy arguments with inserted placed before index at. &[&str] borrows a list of text spellings; usize is the list index type. Why: Injected tokens are ASCII flags, while every existing argument keeps its bytes.

In TS you’d write (pseudocode):

const result = [...args.slice(0, at), ...inserted, ...args.slice(at)];