@@ -21,16 +21,24 @@ pub mod raw {
2121 #[ link( wasm_import_module = "spacetime_10.0" ) ]
2222 extern "C" {
2323 /// Queries the `table_id` associated with the given (table) `name`
24- /// where `name` points to a UTF-8 slice in WASM memory of ` name_len` bytes .
24+ /// where `name` is the UTF-8 slice in WASM memory at `name_ptr[.. name_len]` .
2525 ///
2626 /// The table id is written into the `out` pointer.
2727 ///
28- /// Returns an error if
29- /// - a table with the provided `table_id` doesn't exist
30- /// - the slice `(name, name_len)` is not valid UTF-8
31- /// - `name + name_len` overflows a 64-bit address.
32- /// - writing to `out` overflows a 32-bit integer
33- pub fn _get_table_id ( name : * const u8 , name_len : usize , out : * mut TableId ) -> u16 ;
28+ /// # Traps
29+ ///
30+ /// Traps if:
31+ /// - `name_ptr` is NULL or `name` is not in bounds of WASM memory.
32+ /// - `name` is not valid UTF-8.
33+ /// - `out` is NULL or `out[..size_of::<TableId>()]` is not in bounds of WASM memory.
34+ ///
35+ /// # Errors
36+ ///
37+ /// Returns an error:
38+ ///
39+ /// - `NOT_IN_TRANSACTION`, when called outside of a transaction.
40+ /// - `NO_SUCH_TABLE`, when `name` is not the name of a table.
41+ pub fn _table_id_from_name ( name : * const u8 , name_len : usize , out : * mut TableId ) -> u16 ;
3442
3543 /// Finds all rows in the table identified by `table_id`,
3644 /// where the row has a column, identified by `col_id`,
@@ -511,8 +519,8 @@ unsafe fn call<T: Copy>(f: impl FnOnce(*mut T) -> u16) -> Result<T, Errno> {
511519///
512520/// Returns an error if the table does not exist.
513521#[ inline]
514- pub fn get_table_id ( name : & str ) -> Result < TableId , Errno > {
515- unsafe { call ( |out| raw:: _get_table_id ( name. as_ptr ( ) , name. len ( ) , out) ) }
522+ pub fn table_id_from_name ( name : & str ) -> Result < TableId , Errno > {
523+ unsafe { call ( |out| raw:: _table_id_from_name ( name. as_ptr ( ) , name. len ( ) , out) ) }
516524}
517525
518526/// Finds all rows in the table identified by `table_id`,
0 commit comments