Skip to main content

Grid

Struct Grid 

Source
pub struct Grid { /* private fields */ }
Expand description

A sparse grid of string cells.

Sparse because an Office-like document is mostly empty: a million-cell sheet with 900k empty cells must not allocate a million Strings.

Implementations§

Source§

impl Grid

Source

pub fn new() -> Self

Source

pub fn set(&mut self, cell: CellRef, value: String)

Source

pub fn get(&self, cell: CellRef) -> Option<&str>

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn count_in(&self, range: CellRange) -> usize

Number of populated cells inside a range.

Source

pub fn used_rows(&self) -> usize

Highest populated row + 1.

Source

pub fn used_cols(&self) -> usize

Highest populated column + 1.

Source

pub fn fill_down( &mut self, from: CellRef, count: usize, max_rows: usize, ) -> Result<usize, FcError>

Fills count rows below a cell with the same value.

Auto-fill. Bounded by max_rows so a malformed argument cannot spin allocating millions of cells.

Source§

impl Grid

Source

pub fn js_new() -> Grid

Source

pub fn js_set(&mut self, row: usize, col: usize, value: String)

Source

pub fn js_get(&self, row: usize, col: usize) -> Option<String>

Source

pub fn js_len(&self) -> usize

Source

pub fn js_used_rows(&self) -> usize

Source

pub fn js_used_cols(&self) -> usize

Source

pub fn js_fill_down( &mut self, row: usize, col: usize, count: usize, max_rows: usize, ) -> Result<usize, JsValue>

Source

pub fn js_count_in(&self, r1: usize, c1: usize, r2: usize, c2: usize) -> usize

count populated cells inside a range.

Trait Implementations§

Source§

impl Clone for Grid

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Grid

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Grid

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Grid

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Grid> for JsValue

Source§

fn from(value: Grid) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for Grid

Source§

type Abi = u32

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: u32) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl IntoWasmAbi for Grid

Source§

type Abi = u32

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl LongRefFromWasmAbi for Grid

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRef<Grid>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl OptionFromWasmAbi for Grid

Source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for Grid

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl RefFromWasmAbi for Grid

Source§

type Abi = u32

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = RcRef<Grid>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
Source§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl RefMutFromWasmAbi for Grid

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRefMut<Grid>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl Serialize for Grid

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl SupportsConstructor for Grid

Source§

impl SupportsInstanceProperty for Grid

Source§

impl SupportsStaticProperty for Grid

Source§

impl TryFromJsValue for Grid

Source§

fn try_from_js_value(value: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

fn try_from_js_value_ref(value: &JsValue) -> Option<Self>

Performs the conversion.
Source§

impl VectorFromWasmAbi for Grid

Source§

type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi

Source§

unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Grid]>

Source§

impl VectorIntoWasmAbi for Grid

Source§

type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi

Source§

fn vector_into_abi(vector: Box<[Grid]>) -> Self::Abi

Source§

impl WasmDescribe for Grid

Source§

impl WasmDescribeVector for Grid

Auto Trait Implementations§

§

impl Freeze for Grid

§

impl RefUnwindSafe for Grid

§

impl Send for Grid

§

impl Sync for Grid

§

impl Unpin for Grid

§

impl UnsafeUnpin for Grid

§

impl UnwindSafe for Grid

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more