baml.ops.ShiftLeft

The left-shift operator, `self << rhs`.

Reference version

Signature

interface baml.ops.ShiftLeft<Rhs extends baml.Concrete>

The left-shift operator, self << rhs.

Rhs is the count, not a second operand of the same kind, which is the shape of Rust's ops::Shl. BAML differs from Rust in one way worth knowing: the count's type participates in the result type, so a bigint count widens the shifted value to bigint before shifting rather than merely being converted to a machine width.

In the integer impls, shifting a negative value left is well defined — the operand is a two's-complement bit pattern — while a negative count is always an error, never a right shift.

An implementation may panic, which throws never does not rule out; a caller working through a generic bound cannot enumerate the panics and must be ready for one it cannot describe. See baml.ops.Add.

Source:<builtin>/baml/ns_ops/bitwise.bamlbytes 5137–5538

Associated types

type Output

Required instance methods

function

shl

(self, rhs: Rhs) -> (Self as baml.ops.ShiftLeft<Rhs>).Output throws never

Shifts self left by rhs bit positions.