Skip to content

Instantly share code, notes, and snippets.

@brson
Created January 19, 2012 01:22
Show Gist options
  • Save brson/1636994 to your computer and use it in GitHub Desktop.
Save brson/1636994 to your computer and use it in GitHub Desktop.

Crate core

Module box

Function ptr_eq

Determine if two shared boxes point to the same object

Arguments:

  • a: @T
  • b: @T

Returns bool

Module char

Function is_lowercase

Indicates whether a character is in lower case, defined in terms of the Unicode General Category 'Ll'.

Arguments:

  • c: char

Returns bool

Function is_uppercase

Indicates whether a character is in upper case, defined in terms of the Unicode General Category 'Lu'.

Arguments:

  • c: char

Returns bool

Function is_whitespace

Indicates whether a character is whitespace, defined in terms of the Unicode General Categories 'Zs', 'Zl', 'Zp' additional 'Cc'-category control codes in the range [0x09, 0x0d]

Arguments:

  • c: char

Returns bool

Function is_alphanumeric

Indicates whether a character is alphanumeric, defined in terms of the Unicode General Categories 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.

Arguments:

  • c: char

Returns bool

Function to_digit

Convert a char to the corresponding digit. Safety note: This function fails if c is not a valid char

Arguments:

  • c: char

Returns u8

Function maybe_digit

Convert a char to the corresponding digit. Returns none when character is not a valid hexadecimal digit.

Arguments:

  • c: char

Returns option::t<u8>

Function to_lower

Convert a char to the corresponding lower case.

Arguments:

  • c: char

Returns char

Function to_upper

Convert a char to the corresponding upper case.

Arguments:

  • c: char

Returns char

Function cmp

Compare two chars.

Arguments:

  • a: char
  • b: char

Returns int

Module float

Module bessel

Module f32

Module consts

Module f64

Module consts

Module int

Module str

Module ptr

Module uint

Module u8

Module u32

Module u64

Module vec

Module unsafe

Module u8

Module bool

Function not

Negation/Inverse

Arguments:

  • v: t

Returns t

Function and

Conjunction

Arguments:

  • a: t
  • b: t

Returns t

Function or

Disjunction

Arguments:

  • a: t
  • b: t

Returns t

Function xor

Exclusive or, i.e. or(and(a, not(b)), and(not(a), b))

Arguments:

  • a: t
  • b: t

Returns t

Function implies

Implication in the logic, i.e. from a follows b

Arguments:

  • a: t
  • b: t

Returns t

Function eq

true if truth values a and b are indistinguishable in the logic

Arguments:

  • a: t
  • b: t

Returns bool

Function ne

true if truth values a and b are distinguishable in the logic

Arguments:

  • a: t
  • b: t

Returns bool

Function is_true

true if v represents truth in the logic

Arguments:

  • v: t

Returns bool

Function is_false

true if v represents falsehood in the logic

Arguments:

  • v: t

Returns bool

Function from_str

Parse logic value from s

Arguments:

  • s: str

Returns t

Function to_str

Convert v into a string

Arguments:

  • v: t

Returns str

Function all_values

Iterates over all truth values by passing them to blk in an unspecified order

Arguments:

  • blk: fn&(v: t)

Returns ()

Function to_bit

converts truth value to an 8 bit byte

Arguments:

  • v: t

Returns u8

Module unicode

Module general_category

Module derived_property

Module either

Module option

Module result

Module tuple

Module ctypes

Module math

Module cmath

Module c_float_targ_consts

Module c_double_targ_consts

Module sys

Function set_exit_status

Sets the process exit code

Sets the exit code returned by the process if all supervised tasks terminate successfully (without failing). If the current root task fails and is supervised by the scheduler then any user-specified exit status is ignored and the process exits with the default failure status.

Arguments:

  • code: int

Returns ()

Function set_min_stack

Globally set the minimum size, in bytes, of a stack segment

Rust tasks have segmented stacks that are connected in a linked list allowing them to start very small and grow very large. In some situations this can result in poor performance. Calling this function will set the minimum size of all stack segments allocated in the future, for all tasks.

Arguments:

  • size: uint

Returns ()

Module unsafe

Module comm

Function send

Sends data over a channel. The sent data is moved into the channel, whereupon the caller loses access to it.

Arguments:

  • ch: chan<T>
  • data: T

Returns ()

Function port

Constructs a port.

Returns port<T>

Function recv

Receive from a port. If no data is available on the port then the task will block until data becomes available.

Arguments:

  • p: port<T>

Returns T

Function recv_

Receive on a raw port pointer

Arguments:

  • p: *rustrt::rust_port

Returns T

Function chan

Constructs a channel. The channel is bound to the port used to construct it.

Arguments:

  • p: port<T>

Returns chan<T>

Module task

Module logging

Function console_on

Turns on logging to stdout globally

Returns ()

Function console_off

Turns off logging to stdout globally

Turns off the console unless the user has overridden the runtime environment's logging spec, e.g. by setting the RUST_LOG environment variable

Returns ()

Module extfmt

Module ct

Module rt

Module core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment