MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / try_from

Method try_from

templates/basic-cpp/src/module_bindings/mod.rs:62–74  ·  view source on GitHub ↗
(raw: __ws::v2::TransactionUpdate)

Source from the content-addressed store, hash-verified

60impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate {
61 type Error = __sdk::Error;
62 fn try_from(raw: __ws::v2::TransactionUpdate) -> Result<Self, Self::Error> {
63 let mut db_update = DbUpdate::default();
64 for table_update in __sdk::transaction_update_iter_table_updates(raw) {
65 match &table_update.table_name[..] {
66 "person" => db_update.person.append(person_table::parse_table_update(table_update)?),
67
68 unknown => {
69 return Err(__sdk::InternalError::unknown_name("table", unknown, "DatabaseUpdate").into());
70 }
71 }
72 }
73 Ok(db_update)
74 }
75}
76
77impl __sdk::InModule for DbUpdate {

Callers

nothing calls this directly

Calls 5

parse_table_updateFunction · 0.70
ErrFunction · 0.50
OkFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected