Function vonuvoli_scheme::internals::builtins::port_input_coerce_arguments[][src]

pub fn port_input_coerce_arguments<'a>(
    port: &'a Value,
    count: Option<&'a Value>,
    full: Option<bool>,
    full_default: bool
) -> Outcome<(&'a Port, Option<usize>, bool, usize)>

Arguments

  • count defaults to DEFAULT_PORT_BUFFER_SIZE if (the original) full is None and full_default is false;
  • full defaults to Some (true) if (the original) count is Some(_); else it defaults to full_default;
  • (full_default mainly is used by *_read_*_until family of functions;)

Returns

  • &Port
  • count : Option<usize> -- the actual count to be used by the above rules;
  • full : bool -- the actual full to be used by the above rules;
  • buffer : usize -- the "guessed" buffer capacity required;

Notes

Combining count and full one can obtain a wide range of behaviour:

  • count == Some (_) and full == Some (true) | None -- read exactly count bytes; (could require multiple syscalls;)
  • count == Some (_) and full == Some (false) -- read at most count bytes; (should require a single syscall;)
  • count == None and full == Some (true) -- read everything until EOF; (could require multiple syscalls;)
  • count == None and full == Some (false) | None -- read any bytes available; (should require a single syscall;)
  • count == Some (0) -- makes no sense!