# Rust gRPC driver

## [](#_connection_header)Connection

### [](#_struct_TypeDBDriver)TypeDBDriver

`struct`

**Implements traits:**

*   `Debug`
    

A connection to a TypeDB server which serves as the starting point for all interaction.

#### [](#_struct_TypeDBDriver_configured_addresses_)configured\_addresses

```rust
pub fn configured_addresses(&self) -> &Addresses
```

The `Addresses` this connection is configured to.

Returns

```rust
&Addresses
```

Code examples

```rust
driver.configured_addresses()
```

#### [](#_struct_TypeDBDriver_databases_)databases

```rust
pub fn databases(&self) -> &DatabaseManager
```

The `DatabaseManager` for this connection, providing access to database management methods.

Returns

```rust
&DatabaseManager
```

Code examples

```rust
driver.databases()
```

#### [](#_struct_TypeDBDriver_force_close_)force\_close

```rust
pub fn force_close(&self) -> Result
```

Closes this connection if it is open.

Returns

```rust
Result
```

Code examples

```rust
driver.force_close()
```

#### [](#_struct_TypeDBDriver_is_open_)is\_open

```rust
pub fn is_open(&self) -> bool
```

Checks it this connection is opened.

Returns

```rust
bool
```

Code examples

```rust
driver.is_open()
```

#### [](#_struct_TypeDBDriver_new_addresses_Addresses_credentials_Credentials_driver_options_DriverOptions)new

*   async
    
*   sync
    

```rust
pub async fn new(
    addresses: Addresses,
    credentials: Credentials,
    driver_options: DriverOptions,
) -> Result<Self>
```

```rust
pub fn new(
    addresses: Addresses,
    credentials: Credentials,
    driver_options: DriverOptions,
) -> Result<Self>
```

Creates a new TypeDB Server connection.

Input parameters   

Name

Description

Type

`addresses`

— The address(es) of the TypeDB Server(s), provided in a unified format

`Addresses`

`credentials`

— The Credentials to connect with

`Credentials`

`driver_options`

— The DriverOptions to connect with

`DriverOptions`

Returns

```rust
Result<Self>
```

Code examples

*   async
    
*   sync
    

```rust
TypeDBDriver::new(Addresses::try_from_address_str("127.0.0.1:1729").unwrap(), Credentials::new("username", "password"), DriverOptions::new(true, None)).await
```

```rust
TypeDBDriver::new(Addresses::try_from_address_str("127.0.0.1:1729").unwrap(), Credentials::new("username", "password"), DriverOptions::new(true, None))
```

#### [](#_struct_TypeDBDriver_new_with_description_addresses_Addresses_credentials_Credentials_driver_options_DriverOptions_driver_lang_impl_AsRef_str_)new\_with\_description

*   async
    
*   sync
    

```rust
pub async fn new_with_description(
    addresses: Addresses,
    credentials: Credentials,
    driver_options: DriverOptions,
    driver_lang: impl AsRef<str>,
) -> Result<Self>
```

```rust
pub fn new_with_description(
    addresses: Addresses,
    credentials: Credentials,
    driver_options: DriverOptions,
    driver_lang: impl AsRef<str>,
) -> Result<Self>
```

Creates a new TypeDB Server connection with a description. This method is generally used by TypeDB drivers built on top of the Rust driver. In other cases, use [`Self::new`](#_struct_TypeDBDriver_method_new) instead.

Input parameters   

Name

Description

Type

`addresses`

— The address(es) of the TypeDB Server(s), provided in a unified format

`Addresses`

`credentials`

— The Credentials to connect with

`Credentials`

`driver_options`

— The DriverOptions to connect with

`DriverOptions`

`driver_lang`

— The language of the driver connecting to the server

`impl AsRef<str>`

Returns

```rust
Result<Self>
```

Code examples

*   async
    
*   sync
    

```rust
TypeDBDriver::new_with_description(Addresses::try_from_address_str("127.0.0.1:1729").unwrap(), Credentials::new("username", "password"), DriverOptions::new(true, None), "rust").await
```

```rust
TypeDBDriver::new_with_description(Addresses::try_from_address_str("127.0.0.1:1729").unwrap(), Credentials::new("username", "password"), DriverOptions::new(true, None), "rust")
```

#### [](#_struct_TypeDBDriver_options_)options

```rust
pub fn options(&self) -> &DriverOptions
```

Updates address translation of the driver. This lets you actualize new translation information without recreating the driver from scratch. Useful after registering new replicas requiring address translation. This operation will update existing connections using the provided addresses.

The `DriverOptions` for this connection.

Returns

```rust
&DriverOptions
```

Code examples

```rust
driver.options()
```

#### [](#_struct_TypeDBDriver_primary_server_)primary\_server

*   async
    
*   sync
    

```rust
pub async fn primary_server(&self) -> Result<Option<AvailableServer>>
```

```rust
pub fn primary_server(&self) -> Result<Option<AvailableServer>>
```

Retrieves the primary server, if exists, using default automatic server routing.

See [`Self::primary_server_with_routing`](#_struct_TypeDBDriver_method_primary_server_with_routing) for more details and options.

Returns

```rust
Result<Option<AvailableServer>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.primary_server().await;
```

```rust
driver.primary_server();
```

#### [](#_struct_TypeDBDriver_primary_server_with_routing_server_routing_ServerRouting)primary\_server\_with\_routing

*   async
    
*   sync
    

```rust
pub async fn primary_server_with_routing(
    &self,
    server_routing: ServerRouting,
) -> Result<Option<AvailableServer>>
```

```rust
pub fn primary_server_with_routing(
    &self,
    server_routing: ServerRouting,
) -> Result<Option<AvailableServer>>
```

Retrieves the primary server, if exists.

Input parameters   

Name

Description

Type

`server_routing`

— The server routing directive to use for the operation

`ServerRouting`

Returns

```rust
Result<Option<AvailableServer>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.primary_server_with_routing(ServerRouting::Auto).await;
```

```rust
driver.primary_server_with_routing(ServerRouting::Auto);
```

#### [](#_struct_TypeDBDriver_server_version_)server\_version

*   async
    
*   sync
    

```rust
pub async fn server_version(&self) -> Result<ServerVersion>
```

```rust
pub fn server_version(&self) -> Result<ServerVersion>
```

Retrieves the server’s version, using default automatic server routing.

See [`Self::server_version_with_routing`](#_struct_TypeDBDriver_method_server_version_with_routing) for more details and options.

Returns

```rust
Result<ServerVersion>
```

Code examples

*   async
    
*   sync
    

```rust
driver.server_version().await
```

```rust
driver.server_version()
```

#### [](#_struct_TypeDBDriver_server_version_with_routing_server_routing_ServerRouting)server\_version\_with\_routing

*   async
    
*   sync
    

```rust
pub async fn server_version_with_routing(
    &self,
    server_routing: ServerRouting,
) -> Result<ServerVersion>
```

```rust
pub fn server_version_with_routing(
    &self,
    server_routing: ServerRouting,
) -> Result<ServerVersion>
```

Retrieves the server’s version.

Input parameters   

Name

Description

Type

`server_routing`

— The server routing directive to use for the operation

`ServerRouting`

Returns

```rust
Result<ServerVersion>
```

Code examples

*   async
    
*   sync
    

```rust
driver.server_version_with_routing(ServerRouting::Auto).await;
```

```rust
driver.server_version_with_routing(ServerRouting::Auto);
```

#### [](#_struct_TypeDBDriver_servers_)servers

*   async
    
*   sync
    

```rust
pub async fn servers(&self) -> Result<HashSet<Server>>
```

```rust
pub fn servers(&self) -> Result<HashSet<Server>>
```

Retrieves the servers, using default automatic server routing.

See [`Self::servers_with_routing`](#_struct_TypeDBDriver_method_servers_with_routing) for more details and options.

Returns

```rust
Result<HashSet<Server>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.servers().await;
```

```rust
driver.servers();
```

#### [](#_struct_TypeDBDriver_servers_with_routing_server_routing_ServerRouting)servers\_with\_routing

*   async
    
*   sync
    

```rust
pub async fn servers_with_routing(
    &self,
    server_routing: ServerRouting,
) -> Result<HashSet<Server>>
```

```rust
pub fn servers_with_routing(
    &self,
    server_routing: ServerRouting,
) -> Result<HashSet<Server>>
```

Retrieves the servers.

Input parameters   

Name

Description

Type

`server_routing`

— The server routing directive to use for the operation

`ServerRouting`

Returns

```rust
Result<HashSet<Server>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.servers_with_routing(ServerRouting::Auto).await;
```

```rust
driver.servers_with_routing(ServerRouting::Auto);
```

#### [](#_struct_TypeDBDriver_transaction_)transaction

*   async
    
*   sync
    

```rust
pub async fn transaction(
    &self,
    database_name: impl AsRef<str>,
    transaction_type: TransactionType,
) -> Result<Transaction>
```

```rust
pub fn transaction(
    &self,
    database_name: impl AsRef<str>,
    transaction_type: TransactionType,
) -> Result<Transaction>
```

Opens a transaction with default options.

See [`TypeDBDriver::transaction_with_options`](#_struct_TypeDBDriver_method_transaction_with_options) for more details.

Returns

```rust
Result<Transaction>
```

Code examples

*   async
    
*   sync
    

```rust
driver.transaction(database_name, TransactionType::Read).await;
```

```rust
driver.transaction(database_name, TransactionType::Read);
```

#### [](#_struct_TypeDBDriver_transaction_with_options_database_name_impl_AsRef_str_transaction_type_TransactionType_options_TransactionOptions)transaction\_with\_options

*   async
    
*   sync
    

```rust
pub async fn transaction_with_options(
    &self,
    database_name: impl AsRef<str>,
    transaction_type: TransactionType,
    options: TransactionOptions,
) -> Result<Transaction>
```

```rust
pub fn transaction_with_options(
    &self,
    database_name: impl AsRef<str>,
    transaction_type: TransactionType,
    options: TransactionOptions,
) -> Result<Transaction>
```

Opens a new transaction with custom transaction options.

Input parameters   

Name

Description

Type

`database_name`

— The name of the database to connect to

`impl AsRef<str>`

`transaction_type`

— The TransactionType to open the transaction with

`TransactionType`

`options`

— The TransactionOptions to open the transaction with

`TransactionOptions`

Returns

```rust
Result<Transaction>
```

Code examples

*   async
    
*   sync
    

```rust
transaction.transaction_with_options(database_name, transaction_type, options).await
```

```rust
transaction.transaction_with_options(database_name, transaction_type, options)
```

#### [](#_struct_TypeDBDriver_users_)users

```rust
pub fn users(&self) -> &UserManager
```

The `UserManager` for this connection, providing access to user management methods.

Returns

```rust
&UserManager
```

Code examples

```rust
driver.databases()
```

### [](#_struct_Credentials)Credentials

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

User credentials for connecting to TypeDB

#### [](#_struct_Credentials_new_username_str_password_str)new

```rust
pub fn new(username: &str, password: &str) -> Self
```

Creates a credentials with username and password.

Input parameters   

Name

Description

Type

`username`

— The name of the user to connect as

`&str`

`password`

— The password for the user

`&str`

Returns

```rust
Self
```

Code examples

```rust
Credentials::new(username, password);
```

#### [](#_struct_Credentials_password_)password

```rust
pub fn password(&self) -> &str
```

Retrieves the password used.

Returns

```rust
&str
```

#### [](#_struct_Credentials_username_)username

```rust
pub fn username(&self) -> &str
```

Retrieves the username used.

Returns

```rust
&str
```

### [](#_struct_DriverOptions)DriverOptions

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Default`
    

TypeDB driver connection options. `DriverOptions` object can be used to override the default driver behavior while connecting to TypeDB.

Fields   

Name

Type

Description

`primary_failover_retries`

`usize`

Specifies the number of retries the driver performs to find and reach the cluster primary after a failed request, before giving up. Total attempts per user request = `N + 1`. Each retry either follows the server’s redirect address (fast path) or polls the known replicas with a 2-second sleep between polls (slow path). Set to `0` to disable failover. Defaults to 1.

`request_timeout`

`Duration`

Specifies the maximum time to wait for a response to a unary RPC request. This applies to operations like database creation, user management, and initial transaction opening. It does NOT apply to operations within transactions (queries, commits). Defaults to 2 hours.

`tls_config`

`DriverTlsConfig`

Specifies the TLS configuration of the connection to TypeDB. WARNING: Disabled TLS settings will make the driver sending passwords as plaintext. Defaults to an enabled TLS configuration based on the system’s native trust roots.

#### [](#_struct_DriverOptions_new_)new

```rust
pub fn new(tls_config: DriverTlsConfig) -> Self
```

Creates new `DriverOptions` to configure connections to TypeDB using custom TLS settings. WARNING: Disabled TLS settings will make the driver sending passwords as plaintext.

Returns

```rust
Self
```

#### [](#_struct_DriverOptions_primary_failover_retries_)primary\_failover\_retries

```rust
pub fn primary_failover_retries(self, primary_failover_retries: usize) -> Self
```

Specifies the number of retries the driver performs to find and reach the cluster primary after a failed request, before giving up. Total attempts per user request = `N + 1`. Each retry either follows the server’s redirect address (fast path) or polls the known replicas with a 2-second sleep between polls (slow path). Set to `0` to disable failover. Defaults to 1.

Returns

```rust
Self
```

#### [](#_struct_DriverOptions_request_timeout_)request\_timeout

```rust
pub fn request_timeout(self, request_timeout: Duration) -> Self
```

Specifies the maximum time to wait for a response to a unary RPC request. This applies to operations like database creation, user management, and initial transaction opening. It does NOT apply to operations within transactions (queries, commits). Defaults to 2 hours.

Returns

```rust
Self
```

#### [](#_struct_DriverOptions_tls_config_)tls\_config

```rust
pub fn tls_config(self, tls_config: DriverTlsConfig) -> Self
```

Override the existing TLS configuration. WARNING: Disabled TLS settings will make the driver sending passwords as plaintext.

Returns

```rust
Self
```

### [](#_struct_DatabaseManager)DatabaseManager

`struct`

**Implements traits:**

*   `Debug`
    

Provides access to all database management methods.

#### [](#_struct_DatabaseManager_all_)all

*   async
    
*   sync
    

```rust
pub async fn all(&self) -> Result<Vec<Arc<Database>>>
```

```rust
pub fn all(&self) -> Result<Vec<Arc<Database>>>
```

Retrieves all databases present on the TypeDB server.

Returns

```rust
Result<Vec<Arc<Database>>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.databases().all().await;
```

```rust
driver.databases().all();
```

#### [](#_struct_DatabaseManager_contains_name_impl_Into_String_)contains

*   async
    
*   sync
    

```rust
pub async fn contains(&self, name: impl Into<String>) -> Result<bool>
```

```rust
pub fn contains(&self, name: impl Into<String>) -> Result<bool>
```

Checks if a database with the given name exists.

Input parameters   

Name

Description

Type

`name`

— The database name to be checked

`impl Into<String>`

Returns

```rust
Result<bool>
```

Code examples

*   async
    
*   sync
    

```rust
driver.databases().contains(name).await;
```

```rust
driver.databases().contains(name);
```

#### [](#_struct_DatabaseManager_create_name_impl_Into_String_)create

*   async
    
*   sync
    

```rust
pub async fn create(&self, name: impl Into<String>) -> Result
```

```rust
pub fn create(&self, name: impl Into<String>) -> Result
```

Creates a database with the given name.

Input parameters   

Name

Description

Type

`name`

— The name of the database to be created

`impl Into<String>`

Returns

```rust
Result
```

Code examples

*   async
    
*   sync
    

```rust
driver.databases().create(name).await;
```

```rust
driver.databases().create(name);
```

#### [](#_struct_DatabaseManager_get_name_impl_Into_String_)get

*   async
    
*   sync
    

```rust
pub async fn get(&self, name: impl Into<String>) -> Result<Arc<Database>>
```

```rust
pub fn get(&self, name: impl Into<String>) -> Result<Arc<Database>>
```

Retrieves the database with the given name.

Input parameters   

Name

Description

Type

`name`

— The name of the database to retrieve

`impl Into<String>`

Returns

```rust
Result<Arc<Database>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.databases().get(name).await;
```

```rust
driver.databases().get(name);
```

#### [](#_struct_DatabaseManager_import_from_file_name_impl_Into_String_schema_impl_Into_String_data_file_path_impl_AsRef_Path_)import\_from\_file

*   async
    
*   sync
    

```rust
pub async fn import_from_file(
    &self,
    name: impl Into<String>,
    schema: impl Into<String>,
    data_file_path: impl AsRef<Path>,
) -> Result
```

```rust
pub fn import_from_file(
    &self,
    name: impl Into<String>,
    schema: impl Into<String>,
    data_file_path: impl AsRef<Path>,
) -> Result
```

Creates a database with the given name based on previously exported another database’s data loaded from a file. This is a blocking operation and may take a significant amount of time depending on the database size.

Input parameters   

Name

Description

Type

`name`

— The name of the database to be created

`impl Into<String>`

`schema`

— The schema definition query string for the database

`impl Into<String>`

`data_file_path`

— The exported database file to import the data from

`impl AsRef<Path>`

Returns

```rust
Result
```

Code examples

*   async
    
*   sync
    

```rust
driver.databases().import_from_file(name, schema, data_path).await;
```

```rust
driver.databases().import_from_file(name, schema, data_path);
```

### [](#_struct_Database)Database

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

A TypeDB database.

#### [](#_struct_Database_delete_)delete

*   async
    
*   sync
    

```rust
pub async fn delete(self: Arc<Self>) -> Result
```

```rust
pub fn delete(self: Arc<Self>) -> Result
```

Deletes this database.

Returns

```rust
Result
```

Code examples

*   async
    
*   sync
    

```rust
database.delete().await;
```

```rust
database.delete();
```

#### [](#_struct_Database_export_to_file_schema_file_path_impl_AsRef_Path_data_file_path_impl_AsRef_Path_)export\_to\_file

*   async
    
*   sync
    

```rust
pub async fn export_to_file(
    &self,
    schema_file_path: impl AsRef<Path>,
    data_file_path: impl AsRef<Path>,
) -> Result
```

```rust
pub fn export_to_file(
    &self,
    schema_file_path: impl AsRef<Path>,
    data_file_path: impl AsRef<Path>,
) -> Result
```

Export a database into a schema definition and a data files saved to the disk. This is a blocking operation and may take a significant amount of time depending on the database size.

Input parameters   

Name

Description

Type

`schema_file_path`

— The path to the schema definition file to be created

`impl AsRef<Path>`

`data_file_path`

— The path to the data file to be created

`impl AsRef<Path>`

Returns

```rust
Result
```

Code examples

*   async
    
*   sync
    

```rust
database.export_to_file(schema_path, data_path).await;
```

```rust
database.export_to_file(schema_path, data_path);
```

#### [](#_struct_Database_name_)name

```rust
pub fn name(&self) -> &str
```

Retrieves the database name as a string.

Returns

```rust
&str
```

#### [](#_struct_Database_schema_)schema

*   async
    
*   sync
    

```rust
pub async fn schema(&self) -> Result<String>
```

```rust
pub fn schema(&self) -> Result<String>
```

Returns a full schema text as a valid TypeQL define query string.

Returns

```rust
Result<String>
```

Code examples

*   async
    
*   sync
    

```rust
database.schema().await;
```

```rust
database.schema();
```

#### [](#_struct_Database_type_schema_)type\_schema

*   async
    
*   sync
    

```rust
pub async fn type_schema(&self) -> Result<String>
```

```rust
pub fn type_schema(&self) -> Result<String>
```

Returns the types in the schema as a valid TypeQL define query string.

Returns

```rust
Result<String>
```

Code examples

*   async
    
*   sync
    

```rust
database.type_schema().await;
```

```rust
database.type_schema();
```

### [](#_struct_UserManager)UserManager

`struct`

**Implements traits:**

*   `Debug`
    

Provides access to all user management methods.

#### [](#_struct_UserManager_all_)all

*   async
    
*   sync
    

```rust
pub async fn all(&self) -> Result<Vec<User>>
```

```rust
pub fn all(&self) -> Result<Vec<User>>
```

Retrieves all users which exist on the TypeDB server.

Returns

```rust
Result<Vec<User>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.users().all().await;
```

```rust
driver.users().all();
```

#### [](#_struct_UserManager_contains_username_impl_Into_String_)contains

*   async
    
*   sync
    

```rust
pub async fn contains(&self, username: impl Into<String>) -> Result<bool>
```

```rust
pub fn contains(&self, username: impl Into<String>) -> Result<bool>
```

Checks if a user with the given name exists.

Input parameters   

Name

Description

Type

`username`

— The username to be checked

`impl Into<String>`

Returns

```rust
Result<bool>
```

Code examples

*   async
    
*   sync
    

```rust
driver.users().contains(username).await;
```

```rust
driver.users().contains(username);
```

#### [](#_struct_UserManager_create_username_impl_Into_String_password_impl_Into_String_)create

*   async
    
*   sync
    

```rust
pub async fn create(
    &self,
    username: impl Into<String>,
    password: impl Into<String>,
) -> Result
```

```rust
pub fn create(
    &self,
    username: impl Into<String>,
    password: impl Into<String>,
) -> Result
```

Creates a user with the given name & password.

Input parameters   

Name

Description

Type

`username`

— The name of the user to be created

`impl Into<String>`

`password`

— The password of the user to be created

`impl Into<String>`

Returns

```rust
Result
```

Code examples

*   async
    
*   sync
    

```rust
driver.users().create(username, password).await;
```

```rust
driver.users().create(username, password);
```

#### [](#_struct_UserManager_get_username_impl_Into_String_)get

*   async
    
*   sync
    

```rust
pub async fn get(&self, username: impl Into<String>) -> Result<Option<User>>
```

```rust
pub fn get(&self, username: impl Into<String>) -> Result<Option<User>>
```

Retrieves a user with the given name.

Input parameters   

Name

Description

Type

`username`

— The name of the user to retrieve

`impl Into<String>`

Returns

```rust
Result<Option<User>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.users().get(username).await;
```

```rust
driver.users().get(username);
```

#### [](#_struct_UserManager_get_current_)get\_current

*   async
    
*   sync
    

```rust
pub async fn get_current(&self) -> Result<Option<User>>
```

```rust
pub fn get_current(&self) -> Result<Option<User>>
```

Returns the user of the current connection.

Returns

```rust
Result<Option<User>>
```

Code examples

*   async
    
*   sync
    

```rust
driver.users().get_current().await;
```

```rust
driver.users().get_current();
```

### [](#_struct_User)User

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

A TypeDB server user, identified by a username.

#### [](#_struct_User_delete_)delete

*   async
    
*   sync
    

```rust
pub async fn delete(self) -> Result
```

```rust
pub fn delete(self) -> Result
```

Deletes this user.

Returns

```rust
Result
```

Code examples

*   async
    
*   sync
    

```rust
user.delete().await;
```

```rust
user.delete();
```

#### [](#_struct_User_name_)name

```rust
pub fn name(&self) -> &str
```

Retrieves the username as a string.

Returns

```rust
&str
```

#### [](#_struct_User_password_)password

```rust
pub fn password(&self) -> Option<&str>
```

Retrieves the password as a string, if accessible.

Returns

```rust
Option<&str>
```

#### [](#_struct_User_update_password_password_impl_Into_String_-_Result_)update\_password

*   async
    
*   sync
    

```rust
pub async fn update_password(&self, password: impl Into<String>) -> Result<()>
```

```rust
pub fn update_password(&self, password: impl Into<String>) -> Result<()>
```

Updates the user’s password.

Input parameters   

Name

Description

Type

`password`

— The new password

`impl Into<String>) → Result<(`

Returns

```rust
Result<()>
```

Code examples

*   async
    
*   sync
    

```rust
user.update_password(password).await;
```

```rust
user.update_password(password);
```

## [](#_transaction_header)Transaction

### [](#_struct_Transaction)Transaction

`struct`

**Implements traits:**

*   `Debug`
    

A transaction with a TypeDB database.

#### [](#_struct_Transaction_analyze_query_impl_AsRef_str_)analyze

```rust
pub fn analyze(
    &self,
    query: impl AsRef<str>,
) -> impl Promise<'static, Result<AnalyzedQuery>>
```

Analyzes a TypeQL query in this transaction, returning the translated structure & inferred types.

Input parameters   

Name

Description

Type

`query`

— The TypeQL query to be analyzed

`impl AsRef<str>`

Returns

```rust
impl Promise<'static, Result<AnalyzedQuery>>
```

Code examples

```rust
transaction.analyze(query)
```

#### [](#_struct_Transaction_close_)close

```rust
pub fn close(&self) -> impl Promise<'_, Result<()>>
```

Closes the transaction and returns a resolvable promise

Returns

```rust
impl Promise<'_, Result<()>>
```

Code examples

*   async
    
*   sync
    

```rust
transaction.close().await
```

```rust
transaction.close().resolve()
```

#### [](#_struct_Transaction_commit_)commit

```rust
pub fn commit(self) -> impl Promise<'static, Result>
```

Commits the changes made via this transaction to the TypeDB database. Whether or not the transaction is commited successfully, it gets closed after the commit call.

Returns

```rust
impl Promise<'static, Result>
```

Code examples

*   async
    
*   sync
    

```rust
transaction.commit().await
```

```rust
transaction.commit()
```

#### [](#_struct_Transaction_is_open_)is\_open

```rust
pub fn is_open(&self) -> bool
```

Checks if the transaction is open.

Returns

```rust
bool
```

Code examples

```rust
transaction.is_open()
```

#### [](#_struct_Transaction_on_close_function)on\_close

```rust
pub fn on_close(
    &self,
    callback: impl FnOnce(Option<Error>) + Send + Sync + 'static,
) -> impl Promise<'_, Result<()>>
```

Registers a callback function which will be executed when this transaction is closed returns a resolvable promise that must be awaited otherwise the callback may not be registered

Input parameters   

Name

Description

Type

`function`

— The callback function.

Returns

```rust
impl Promise<'_, Result<()>>
```

Code examples

```rust
transaction.on_close(function)
```

#### [](#_struct_Transaction_query_)query

```rust
pub fn query(
    &self,
    query: impl AsRef<str>,
) -> impl Promise<'static, Result<QueryAnswer>>
```

Performs a TypeQL query with default options. See [`Transaction::query_with_options`](#_struct_Transaction_method_query_with_options)

Returns

```rust
impl Promise<'static, Result<QueryAnswer>>
```

Code examples

```rust
transaction.query(query)
```

#### [](#_struct_Transaction_query_with_options_query_impl_AsRef_str_options_QueryOptions)query\_with\_options

```rust
pub fn query_with_options(
    &self,
    query: impl AsRef<str>,
    options: QueryOptions,
) -> impl Promise<'static, Result<QueryAnswer>>
```

Performs a TypeQL query in this transaction.

Input parameters   

Name

Description

Type

`query`

— The TypeQL query to be executed

`impl AsRef<str>`

`options`

— The QueryOptions to execute the query with

`QueryOptions`

Returns

```rust
impl Promise<'static, Result<QueryAnswer>>
```

Code examples

```rust
transaction.query_with_options(query, options)
```

#### [](#_struct_Transaction_query_with_options_and_rows_query_impl_AsRef_str_options_QueryOptions_rows_Option_GivenRows_)query\_with\_options\_and\_rows

```rust
pub fn query_with_options_and_rows(
    &self,
    query: impl AsRef<str>,
    options: QueryOptions,
    rows: Option<GivenRows>,
) -> impl Promise<'static, Result<QueryAnswer>>
```

Performs a TypeQL query in this transaction.

Input parameters   

Name

Description

Type

`query`

— The TypeQL query to be executed

`impl AsRef<str>`

`options`

— The QueryOptions to execute the query with

`QueryOptions`

`rows`

— The GivenRows to pass as input to the query.

`Option<GivenRows>`

Returns

```rust
impl Promise<'static, Result<QueryAnswer>>
```

Code examples

```rust
transaction.query_with_options(query, options, rows)
```

#### [](#_struct_Transaction_query_with_rows_query_impl_AsRef_str_rows_GivenRows)query\_with\_rows

```rust
pub fn query_with_rows(
    &self,
    query: impl AsRef<str>,
    rows: GivenRows,
) -> impl Promise<'static, Result<QueryAnswer>>
```

Performs a TypeQL query in this transaction.

Input parameters   

Name

Description

Type

`query`

— The TypeQL query to be executed

`impl AsRef<str>`

`rows`

— The GivenRows to pass as input to the query.

`GivenRows`

Returns

```rust
impl Promise<'static, Result<QueryAnswer>>
```

Code examples

```rust
transaction.query_with_options(query, options, rows)
```

#### [](#_struct_Transaction_rollback_)rollback

```rust
pub fn rollback(&self) -> impl Promise<'_, Result>
```

Rolls back the uncommitted changes made via this transaction.

Returns

```rust
impl Promise<'_, Result>
```

Code examples

*   async
    
*   sync
    

```rust
transaction.rollback().await
```

```rust
transaction.rollback()
```

#### [](#_struct_Transaction_type_)type\_

```rust
pub fn type_(&self) -> TransactionType
```

Retrieves the transaction’s type (READ or WRITE).

Returns

```rust
TransactionType
```

### [](#_enum_TransactionType)TransactionType

`enum`

This enum is used to specify the type of transaction.

Enum variants 

Variant

`Read = 0`

`Schema = 2`

`Write = 1`

### [](#_struct_TransactionOptions)TransactionOptions

`struct`

**Implements traits:**

*   `Clone`
    
*   `Copy`
    
*   `Debug`
    
*   `Default`
    

TypeDB transaction options. `TransactionOptions` object can be used to override the default behaviour for opened transactions.

Fields   

Name

Type

Description

`schema_lock_acquire_timeout`

`Option<Duration>`

If set, specifies how long the driver should wait if opening a transaction is blocked by an exclusive schema write lock.

`transaction_timeout`

`Option<Duration>`

If set, specifies a timeout for killing transactions automatically, preventing memory leaks in unclosed transactions.

#### [](#_struct_TransactionOptions_schema_lock_acquire_timeout_)schema\_lock\_acquire\_timeout

```rust
pub fn schema_lock_acquire_timeout(self, timeout: Duration) -> Self
```

If set, specifies how long the driver should wait if opening a transaction is blocked by an exclusive schema write lock.

Returns

```rust
Self
```

#### [](#_struct_TransactionOptions_transaction_timeout_)transaction\_timeout

```rust
pub fn transaction_timeout(self, timeout: Duration) -> Self
```

If set, specifies a timeout for killing transactions automatically, preventing memory leaks in unclosed transactions.

Returns

```rust
Self
```

### [](#_struct_QueryOptions)QueryOptions

`struct`

**Implements traits:**

*   `Clone`
    
*   `Copy`
    
*   `Debug`
    
*   `Default`
    

TypeDB query options. `QueryOptions` object can be used to override the default server behaviour for executed queries.

Fields   

Name

Type

Description

`include_instance_types`

`Option<bool>`

If set, specifies if types should be included in instance structs returned in ConceptRow answers. This option allows reducing the amount of unnecessary data transmitted.

`include_query_structure`

`Option<bool>`

If set, requests the server to return the structure of the query in the ConceptRow header.

`prefetch_size`

`Option<u64>`

If set, specifies the number of extra query responses sent before the client side has to re-request more responses. Increasing this may increase performance for queries with a huge number of answers, as it can reduce the number of network round-trips at the cost of more resources on the server side. Minimal value: 1.

#### [](#_struct_QueryOptions_include_instance_types_)include\_instance\_types

```rust
pub fn include_instance_types(self, include_instance_types: bool) -> Self
```

If set, specifies if types should be included in instance structs returned in ConceptRow answers. This option allows reducing the amount of unnecessary data transmitted.

Returns

```rust
Self
```

#### [](#_struct_QueryOptions_include_query_structure_)include\_query\_structure

```rust
pub fn include_query_structure(self, include_query_structure: bool) -> Self
```

If set, requests the server to return the structure of the query in the ConceptRow header.

Returns

```rust
Self
```

#### [](#_struct_QueryOptions_prefetch_size_)prefetch\_size

```rust
pub fn prefetch_size(self, prefetch_size: u64) -> Self
```

If set, specifies the number of extra query responses sent before the client side has to re-request more responses. Increasing this may increase performance for queries with a huge number of answers, as it can reduce the number of network round-trips at the cost of more resources on the server side.

Returns

```rust
Self
```

## [](#_answer_header)Answer

### [](#_enum_QueryAnswer)QueryAnswer

`enum`

Enum variants 

Variant

`ConceptDocumentStream(Arc<ConceptDocumentHeader>, BoxStream<'static, Result<ConceptDocument>>)`

`ConceptRowStream(Arc<ConceptRowHeader>, BoxStream<'static, Result<ConceptRow>>)`

`Ok(QueryType)`

#### [](#_enum_QueryAnswer_get_query_type_)get\_query\_type

```rust
pub fn get_query_type(&self) -> QueryType
```

Retrieves the executed query’s type (shared by all elements in this stream).

Returns

```rust
QueryType
```

Code examples

```rust
query_answer.get_query_type()
```

#### [](#_enum_QueryAnswer_into_documents_)into\_documents

```rust
pub fn into_documents(self) -> BoxStream<'static, Result<ConceptDocument>>
```

Unwraps the `QueryAnswer` into a `ConceptDocumentStream`. Panics if it is not a `ConceptDocumentStream`.

Returns

```rust
BoxStream<'static, Result<ConceptDocument>>
```

Code examples

```rust
query_answer.into_documents()
```

#### [](#_enum_QueryAnswer_into_rows_)into\_rows

```rust
pub fn into_rows(self) -> BoxStream<'static, Result<ConceptRow>>
```

Unwraps the `QueryAnswer` into a `ConceptRowStream`. Panics if it is not a `ConceptRowStream`.

Returns

```rust
BoxStream<'static, Result<ConceptRow>>
```

Code examples

```rust
query_answer.into_rows()
```

#### [](#_enum_QueryAnswer_is_document_stream_)is\_document\_stream

```rust
pub fn is_document_stream(&self) -> bool
```

Checks if the `QueryAnswer` is a `ConceptDocumentStream`.

Returns

```rust
bool
```

Code examples

```rust
query_answer.is_document_stream()
```

#### [](#_enum_QueryAnswer_is_ok_)is\_ok

```rust
pub fn is_ok(&self) -> bool
```

Checks if the `QueryAnswer` is an `Ok` response.

Returns

```rust
bool
```

Code examples

```rust
query_answer.is_ok()
```

#### [](#_enum_QueryAnswer_is_row_stream_)is\_row\_stream

```rust
pub fn is_row_stream(&self) -> bool
```

Checks if the `QueryAnswer` is a `ConceptRowStream`.

Returns

```rust
bool
```

Code examples

```rust
query_answer.is_row_stream()
```

### [](#_struct_ConceptRow)ConceptRow

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Display`
    
*   `PartialEq`
    

A single row of concepts representing substitutions for variables in the query. Contains a Header (column names and query type), and the row of optional concepts. An empty concept in a column means the variable does not have a substitution in this answer.

Fields   

Name

Type

Description

`row`

`Vec<Option<Concept>>`

#### [](#_struct_ConceptRow_get_var_name)get

```rust
pub fn get(&self, column_name: &str) -> Result<Option<&Concept>>
```

Retrieves a concept for a given variable. Returns an empty optional if the variable name has an empty answer. Returns an error if the variable name is not present.

Input parameters   

Name

Description

Type

`var_name`

— The variable name in the row to retrieve

Returns

```rust
Result<Option<&Concept>>
```

Code examples

```rust
concept_row.get(var_name)
```

#### [](#_struct_ConceptRow_get_column_names_)get\_column\_names

```rust
pub fn get_column_names(&self) -> &[String]
```

Retrieves the row column names (shared by all elements in this stream).

Returns

```rust
&[String]
```

Code examples

```rust
concept_row.get_column_names()
```

#### [](#_struct_ConceptRow_get_concepts_)get\_concepts

```rust
pub fn get_concepts(&self) -> impl Iterator<Item = &Concept>
```

Produces an iterator over all concepts in this `ConceptRow`, skipping empty results

Returns

```rust
impl Iterator<Item = &Concept>
```

Code examples

```rust
concept_row.concepts()
```

#### [](#_struct_ConceptRow_get_index_column_index_usize)get\_index

```rust
pub fn get_index(&self, column_index: usize) -> Result<Option<&Concept>>
```

Retrieves a concept for a given column index. Returns an empty optional if the index points to an empty answer. Returns an error if the index is not in the row’s range.

Input parameters   

Name

Description

Type

`column_index`

— The position in the row to retrieve

`usize`

Returns

```rust
Result<Option<&Concept>>
```

Code examples

```rust
concept_row.get_position(column_index)
```

#### [](#_struct_ConceptRow_get_involved_conjunctions_)get\_involved\_conjunctions

```rust
pub fn get_involved_conjunctions(
    &self,
) -> Option<impl Iterator<Item = ConjunctionID> + '_>
```

Retrieve the `ConjunctionID`s of `Conjunction`s that answered this row.

Returns

```rust
Option<impl Iterator<Item = ConjunctionID> + '_>
```

Code examples

```rust
concept_row.get_involved_conjunctions()
```

#### [](#_struct_ConceptRow_get_involved_conjunctions_cloned_)get\_involved\_conjunctions\_cloned

```rust
pub fn get_involved_conjunctions_cloned(
    &self,
) -> Option<impl Iterator<Item = ConjunctionID> + 'static>
```

Like `ConceptRow::get_involved_conjunctions` but clones the underlying data. Meant for simpler lifetimes over FFI.

Returns

```rust
Option<impl Iterator<Item = ConjunctionID> + 'static>
```

#### [](#_struct_ConceptRow_get_query_structure_)get\_query\_structure

```rust
pub fn get_query_structure(&self) -> Option<&Pipeline>
```

Retrieve the executed query’s structure from the `ConceptRow`’s header, if set. It must be requested via “include query structure” in `QueryOptions`

Returns

```rust
Option<&Pipeline>
```

Code examples

```rust
concept_row.get_query_structure()
```

#### [](#_struct_ConceptRow_get_query_type_)get\_query\_type

```rust
pub fn get_query_type(&self) -> QueryType
```

Retrieves the executed query’s type (shared by all elements in this stream).

Returns

```rust
QueryType
```

Code examples

```rust
concept_row.get_query_type()
```

### [](#_struct_ConceptRowHeader)ConceptRowHeader

`struct`

**Implements traits:**

*   `Debug`
    

Fields   

Name

Type

Description

`column_names`

`Vec<String>`

`query_structure`

`Option<Pipeline>`

`query_type`

`QueryType`

### [](#_struct_ConceptDocument)ConceptDocument

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

A single document of concepts representing substitutions for variables in the query. Contains a Header (query type), and the document of concepts.

Fields   

Name

Type

Description

`root`

`Option<Node>`

#### [](#_struct_ConceptDocument_get_query_type_)get\_query\_type

```rust
pub fn get_query_type(&self) -> QueryType
```

Retrieves the executed query’s type (shared by all elements in this stream).

Returns

```rust
QueryType
```

Code examples

```rust
concept_document.get_query_type()
```

### [](#_struct_ConceptDocumentHeader)ConceptDocumentHeader

`struct`

**Implements traits:**

*   `Debug`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Fields   

Name

Type

Description

`query_type`

`QueryType`

### [](#_enum_JSON)JSON

`enum`

Enum variants 

Variant

`Array(Vec<JSON>)`

`Boolean(bool)`

`Null`

`Number(f64)`

`Object(HashMap<Cow<'static, str>, JSON>)`

`String(Cow<'static, str>)`

### [](#_enum_Node)Node

`enum`

Enum variants 

Variant

`Leaf(Option<Leaf>)`

`List(Vec<Node>)`

`Map(HashMap<String, Node>)`

### [](#_enum_Leaf)Leaf

`enum`

Enum variants 

Variant

`Concept(Concept)`

`Empty`

`Kind(Kind)`

`ValueType(ValueType)`

### [](#_enum_QueryType)QueryType

`enum`

This enum is used to specify the type of the query resulted in this answer.

Enum variants 

Variant

`ReadQuery = 0`

`SchemaQuery = 2`

`WriteQuery = 1`

### [](#_trait_Promise)Trait Promise

`struct`

*   async
    
*   sync
    

Async promise, an alias for Rust’s built-in Future. A `BoxPromise` is an alias for Rust’s built-in BoxFuture.

Examples

```rust
promise.await
```

A resolvable promise that can be resolved at a later time. a `BoxPromise` is in practical terms a `Box<dyn Promise>` and resolves with `.resolve()`.

Examples

```rust
promise.resolve()
```

## [](#_concept_header)Concept

### [](#_enum_Concept)Concept

`enum`

The fundamental TypeQL object.

Enum variants 

Variant

`Attribute(Attribute)`

`AttributeType(AttributeType)`

`Entity(Entity)`

`EntityType(EntityType)`

`Relation(Relation)`

`RelationType(RelationType)`

`RoleType(RoleType)`

`Value(Value)`

#### [](#_enum_Concept_get_category_)get\_category

```rust
pub fn get_category(&self) -> ConceptCategory
```

Retrieves the category of this Concept.

Returns

```rust
ConceptCategory
```

#### [](#_enum_Concept_get_label_)get\_label

```rust
pub fn get_label(&self) -> &str
```

Retrieves the label of this Concept. If this is an Instance, returns the label of the type of this instance (“unknown” if type fetching is disabled). If this is a Value, returns the label of the value type of the value. If this is a Type, returns the label of the type.

Returns

```rust
&str
```

#### [](#_enum_Concept_is_attribute_)is\_attribute

```rust
pub fn is_attribute(&self) -> bool
```

Checks if this Concept represents an Attribute instance from the database

Returns

```rust
bool
```

#### [](#_enum_Concept_is_attribute_type_)is\_attribute\_type

```rust
pub fn is_attribute_type(&self) -> bool
```

Checks if this Concept represents an Attribute Type from the schema of the database

Returns

```rust
bool
```

#### [](#_enum_Concept_is_boolean_)is\_boolean

```rust
pub fn is_boolean(&self) -> bool
```

Checks if this Concept holds a boolean as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_date_)is\_date

```rust
pub fn is_date(&self) -> bool
```

Checks if this Concept holds a date as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_datetime_)is\_datetime

```rust
pub fn is_datetime(&self) -> bool
```

Checks if this Concept holds a datetime as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_datetime_tz_)is\_datetime\_tz

```rust
pub fn is_datetime_tz(&self) -> bool
```

Checks if this Concept holds a timezoned-datetime as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_decimal_)is\_decimal

```rust
pub fn is_decimal(&self) -> bool
```

Checks if this Concept holds a fixed-decimal as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_double_)is\_double

```rust
pub fn is_double(&self) -> bool
```

Checks if this Concept holds a double as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_duration_)is\_duration

```rust
pub fn is_duration(&self) -> bool
```

Checks if this Concept holds a duration as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_entity_)is\_entity

```rust
pub fn is_entity(&self) -> bool
```

Checks if this Concept represents an Entity instance from the database

Returns

```rust
bool
```

#### [](#_enum_Concept_is_entity_type_)is\_entity\_type

```rust
pub fn is_entity_type(&self) -> bool
```

Checks if this Concept represents an Entity Type from the schema of the database

Returns

```rust
bool
```

#### [](#_enum_Concept_is_instance_)is\_instance

```rust
pub fn is_instance(&self) -> bool
```

Checks if this Concept represents a stored database instance from the database. These are exactly: Entity, Relation, and Attribute

Equivalent to:

Returns

```rust
bool
```

Code examples

```rust
concept.is_entity() || concept.is_relation() ||  concept.is_attribute()
```

#### [](#_enum_Concept_is_integer_)is\_integer

```rust
pub fn is_integer(&self) -> bool
```

Checks if this Concept holds an integer as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_relation_)is\_relation

```rust
pub fn is_relation(&self) -> bool
```

Checks if this Concept represents an Relation instance from the database

Returns

```rust
bool
```

#### [](#_enum_Concept_is_relation_type_)is\_relation\_type

```rust
pub fn is_relation_type(&self) -> bool
```

Checks if this Concept represents a Relation Type from the schema of the database

Returns

```rust
bool
```

#### [](#_enum_Concept_is_role_type_)is\_role\_type

```rust
pub fn is_role_type(&self) -> bool
```

Checks if this Concept represents a Role Type from the schema of the database

Returns

```rust
bool
```

#### [](#_enum_Concept_is_string_)is\_string

```rust
pub fn is_string(&self) -> bool
```

Checks if this Concept holds a string as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_struct_)is\_struct

```rust
pub fn is_struct(&self) -> bool
```

Checks if this Concept holds a struct as an AttributeType, an Attribute, or a Value

Returns

```rust
bool
```

#### [](#_enum_Concept_is_type_)is\_type

```rust
pub fn is_type(&self) -> bool
```

Checks if this Concept represents a Type from the schema of the database. These are exactly: Entity Types, Relation Types, Role Types, and Attribute Types

Equivalent to:

Returns

```rust
bool
```

Code examples

```rust
concept.is_entity_type() || concept.is_relation_type() || concept.is_role_type() || concept.is_attribute_type()
```

#### [](#_enum_Concept_is_value_)is\_value

```rust
pub fn is_value(&self) -> bool
```

Checks if this Concept represents a Value returned by the database

Returns

```rust
bool
```

#### [](#_enum_Concept_try_get_boolean_)try\_get\_boolean

```rust
pub fn try_get_boolean(&self) -> Option<bool>
```

Retrieves the boolean value of this Concept, if it exists. If this is a boolean-valued Attribute Instance, returns the boolean value of this instance. If this a boolean-valued Value, returns the boolean value. Otherwise, returns None.

Returns

```rust
Option<bool>
```

#### [](#_enum_Concept_try_get_date_)try\_get\_date

```rust
pub fn try_get_date(&self) -> Option<NaiveDate>
```

Retrieves the date value of this Concept, if it exists. If this is a date-valued Attribute Instance, returns the date value of this instance. If this a date-valued Value, returns the date value. Otherwise, returns None.

Returns

```rust
Option<NaiveDate>
```

#### [](#_enum_Concept_try_get_datetime_)try\_get\_datetime

```rust
pub fn try_get_datetime(&self) -> Option<NaiveDateTime>
```

Retrieves the datetime value of this Concept, if it exists. If this is a datetime-valued Attribute Instance, returns the datetime value of this instance. If this a datetime-valued Value, returns the datetime value. Otherwise, returns None.

Returns

```rust
Option<NaiveDateTime>
```

#### [](#_enum_Concept_try_get_datetime_tz_)try\_get\_datetime\_tz

```rust
pub fn try_get_datetime_tz(&self) -> Option<DateTime<TimeZone>>
```

Retrieves the timezoned-datetime value of this Concept, if it exists. If this is a timezoned-datetime valued Attribute Instance, returns the timezoned-datetime value of this instance. If this a timezoned-datetime valued Value, returns the timezoned-datetime value. Otherwise, returns None.

Returns

```rust
Option<DateTime<TimeZone>>
```

#### [](#_enum_Concept_try_get_decimal_)try\_get\_decimal

```rust
pub fn try_get_decimal(&self) -> Option<Decimal>
```

Retrieves the fixed-decimal value of this Concept, if it exists. If this is a fixed-decimal valued Attribute Instance, returns the fixed-decimal value of this instance. If this a fixed-decimal valued Value, returns the fixed-decimal value. Otherwise, returns None.

Returns

```rust
Option<Decimal>
```

#### [](#_enum_Concept_try_get_double_)try\_get\_double

```rust
pub fn try_get_double(&self) -> Option<f64>
```

Retrieves the double value of this Concept, if it exists. If this is a double-valued Attribute Instance, returns the double value of this instance. If this a double-valued Value, returns the double value. Otherwise, returns None.

Returns

```rust
Option<f64>
```

#### [](#_enum_Concept_try_get_duration_)try\_get\_duration

```rust
pub fn try_get_duration(&self) -> Option<Duration>
```

Retrieves the duration value of this Concept, if it exists. If this is a duration-valued Attribute Instance, returns the duration value of this instance. If this a duration-valued Value, returns the duration value. Otherwise, returns None.

Returns

```rust
Option<Duration>
```

#### [](#_enum_Concept_try_get_iid_)try\_get\_iid

```rust
pub fn try_get_iid(&self) -> Option<&IID>
```

Retrieves the unique id (IID) of this Concept. If this is an Entity or Relation Instance, returns the IID of the instance. Otherwise, returns None.

Returns

```rust
Option<&IID>
```

#### [](#_enum_Concept_try_get_integer_)try\_get\_integer

```rust
pub fn try_get_integer(&self) -> Option<i64>
```

Retrieves the integer value of this Concept, if it exists. If this is an integer-valued Attribute Instance, returns the integer value of this instance. If this an integer-valued Value, returns the integer value. Otherwise, returns None.

Returns

```rust
Option<i64>
```

#### [](#_enum_Concept_try_get_label_)try\_get\_label

```rust
pub fn try_get_label(&self) -> Option<&str>
```

Retrieves the optional label of the concept. If this is an Instance, returns the label of the type of this instance (None if type fetching is disabled). If this is a Value, returns the label of the value type of the value. If this is a Type, returns the label of the type.

Returns

```rust
Option<&str>
```

#### [](#_enum_Concept_try_get_string_)try\_get\_string

```rust
pub fn try_get_string(&self) -> Option<&str>
```

Retrieves the string value of this Concept, if it exists. If this is a string-valued Attribute Instance, returns the string value of this instance. If this a string-valued Value, returns the string value. Otherwise, returns None.

Returns

```rust
Option<&str>
```

#### [](#_enum_Concept_try_get_struct_)try\_get\_struct

```rust
pub fn try_get_struct(&self) -> Option<&Struct>
```

Retrieves the struct value of this Concept, if it exists. If this is a struct-valued Attribute Instance, returns the struct value of this instance. If this a struct-valued Value, returns the struct value. Otherwise, returns None.

Returns

```rust
Option<&Struct>
```

#### [](#_enum_Concept_try_get_value_)try\_get\_value

```rust
pub fn try_get_value(&self) -> Option<&Value>
```

Retrieves the value of this Concept, if it exists. If this is an Attribute Instance, returns the value of this instance. If this a Value, returns the value. Otherwise, returns empty.

Returns

```rust
Option<&Value>
```

#### [](#_enum_Concept_try_get_value_label_)try\_get\_value\_label

```rust
pub fn try_get_value_label(&self) -> Option<&str>
```

Retrieves the label of the value type of the concept, if it exists. If this is an Attribute Instance, returns the label of the value of this instance. If this is a Value, returns the label of the value. If this is an Attribute Type, returns the label of the value type that the schema permits for the attribute type, if one is defined. Otherwise, returns None.

Returns

```rust
Option<&str>
```

#### [](#_enum_Concept_try_get_value_type_)try\_get\_value\_type

```rust
pub fn try_get_value_type(&self) -> Option<ValueType>
```

Retrieves the value type enum of the concept, if it exists. If this is an Attribute Instance, returns the value type of the value of this instance. If this is a Value, returns the value type of the value. If this is an Attribute Type, returns value type that the schema permits for the attribute type, if one is defined. Otherwise, returns None.

Returns

```rust
Option<ValueType>
```

### [](#_enum_ConceptCategory)ConceptCategory

`enum`

Enum variants 

Variant

`Attribute`

`AttributeType`

`Entity`

`EntityType`

`Relation`

`RelationType`

`RoleType`

`Value`

### [](#_enum_Kind)Kind

`enum`

Kind represents the base of a defined type to describe its capabilities. For example, “define entity person;” defines a type “person” of a kind “entity”.

Enum variants 

Variant

`Attribute = 1`

`Entity = 0`

`Relation = 2`

`Role = 3`

## [](#_schema_header)Schema

### [](#_struct_EntityType)EntityType

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Display`
    
*   `Eq`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Entity types represent the classification of independent objects in the data model of the business domain.

Fields   

Name

Type

Description

`label`

`String`

#### [](#_struct_EntityType_label_)label

```rust
pub fn label(&self) -> &str
```

Retrieves the unique label of the `EntityType`.

Returns

```rust
&str
```

Code examples

```rust
entity_type.label()
```

### [](#_struct_RelationType)RelationType

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Display`
    
*   `Eq`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Relation types (or subtypes of the relation root type) represent relationships between types. Relation types have roles.

Other types can play roles in relations if it’s mentioned in their definition.

A relation type must specify at least one role.

Fields   

Name

Type

Description

`label`

`String`

#### [](#_struct_RelationType_label_)label

```rust
pub fn label(&self) -> &str
```

Retrieves the unique label of the `RelationType`.

Returns

```rust
&str
```

Code examples

```rust
relation_type.label()
```

### [](#_struct_RoleType)RoleType

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Display`
    
*   `Eq`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Roles are special internal types used by relations. We can not create an instance of a role in a database. But we can set an instance of another type (role player) to play a role in a particular instance of a relation type.

Roles allow a schema to enforce logical constraints on types of role players.

Fields   

Name

Type

Description

`label`

`String`

#### [](#_struct_RoleType_label_)label

```rust
pub fn label(&self) -> &str
```

Retrieves the unique label of the `RoleType`.

Returns

```rust
&str
```

Code examples

```rust
role_type.label()
```

### [](#_struct_AttributeType)AttributeType

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Display`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Attribute types represent properties that other types can own.

Attribute types have a value type. This value type is fixed and unique for every given instance of the attribute type.

Other types can own an attribute type. That means that instances of these other types can own an instance of this attribute type. This usually means that an object in our domain has a property with the matching value.

Multiple types can own the same attribute type, and different instances of the same type or different types can share ownership of the same attribute instance.

Fields   

Name

Type

Description

`label`

`String`

`value_type`

`Option<ValueType>`

#### [](#_struct_AttributeType_label_)label

```rust
pub fn label(&self) -> &str
```

Retrieves the unique label of the `AttributeType`.

Returns

```rust
&str
```

Code examples

```rust
attribute_type.label()
```

#### [](#_struct_AttributeType_value_type_)value\_type

```rust
pub fn value_type(&self) -> Option<&ValueType>
```

Retrieves the `ValueType` of the `AttributeType`.

Returns

```rust
Option<&ValueType>
```

Code examples

```rust
attribute_type.value_type()
```

### [](#_enum_ValueType)ValueType

`enum`

Represents the type of primitive value is held by a Value or Attribute.

Enum variants 

Variant

`Boolean`

`Date`

`Datetime`

`DatetimeTZ`

`Decimal`

`Double`

`Duration`

`Integer`

`String`

`Struct(String)`

## [](#_data_header)Data

### [](#_struct_Entity)Entity

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Eq`
    
*   `From<Entity>`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Instance of data of an entity type, representing a standalone object that exists in the data model independently. Entity does not have a value. It is usually addressed by its ownership over attribute instances and/or roles played in relation instances.

Fields   

Name

Type

Description

`iid`

`IID`

The unique id of this Entity

`type_`

`Option<EntityType>`

The type which this Entity belongs to

#### [](#_struct_Entity_iid_)iid

```rust
pub fn iid(&self) -> &IID
```

Retrieves the unique id of the `Entity`.

Returns

```rust
&IID
```

Code examples

```rust
entity.iid();
```

### [](#_struct_Relation)Relation

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Eq`
    
*   `From<Relation>`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Relation is an instance of a relation type and can be uniquely addressed by a combination of its type, owned attributes and role players.

Fields   

Name

Type

Description

`iid`

`IID`

The unique id of this Relation

`type_`

`Option<RelationType>`

The type which this Relation belongs to

#### [](#_struct_Relation_iid_)iid

```rust
pub fn iid(&self) -> &IID
```

Retrieves the unique id of the `Relation`.

Returns

```rust
&IID
```

Code examples

```rust
relation.iid();
```

### [](#_struct_Attribute)Attribute

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `From<Attribute>`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Attribute is an instance of the attribute type and has a value. This value is fixed and unique for every given instance of the attribute type. Attributes can be uniquely addressed by their type and value.

Fields   

Name

Type

Description

`iid`

`IID`

The unique id of this Attribute (internal use only)

`type_`

`Option<AttributeType>`

The type which this Attribute belongs to

`value`

`Value`

The (dataful) value of this attribute

### [](#_enum_Value)Value

`enum`

Enum variants 

Variant

`Boolean(bool)`

`Date(NaiveDate)`

`Datetime(NaiveDateTime)`

`DatetimeTZ(DateTime<TimeZone>)`

`Decimal(Decimal)`

`Double(f64)`

`Duration(Duration)`

`Integer(i64)`

`String(String)`

`Struct(Struct, String)`

#### [](#_enum_Value_get_type_)get\_type

```rust
pub fn get_type(&self) -> ValueType
```

Retrieves the `ValueType` of this value concept.

Returns

```rust
ValueType
```

Code examples

```rust
value.get_type();
```

#### [](#_enum_Value_get_type_name_)get\_type\_name

```rust
pub fn get_type_name(&self) -> &str
```

Retrieves the name of the `ValueType` of this value concept.

Returns

```rust
&str
```

Code examples

```rust
value.get_type_name();
```

## [](#_value_header)Value

### [](#_struct_Decimal)Decimal

`struct`

**Implements traits:**

*   `Add`
    
*   `Clone`
    
*   `Copy`
    
*   `Debug`
    
*   `Default`
    
*   `Display`
    
*   `Eq`
    
*   `From<Decimal>`
    
*   `From<Decimal>`
    
*   `FromStr`
    
*   `Hash`
    
*   `Neg`
    
*   `Ord`
    
*   `PartialEq`
    
*   `PartialOrd`
    
*   `StructuralPartialEq`
    
*   `Sub`
    

A fixed-point decimal number. Holds exactly 19 digits after the decimal point and a 64-bit value before the decimal point.

Fields   

Name

Type

Description

`fractional`

`u64`

The fractional part of the decimal, in multiples of 10^-19 (Decimal::FRACTIONAL\_PART\_DENOMINATOR). This means that the smallest decimal representable is 10^-19, and up to 19 decimal places are supported.

`integer`

`i64`

The integer part of the decimal as normal signed 64 bit number

#### [](#_struct_Decimal_from_parts_)from\_parts

```rust
pub const fn from_parts(integer: i64, fractional: u64) -> Self
```

Creates a new Decimal value from the raw integer and fractional parts. The fractional part is specified in multiples of 10^-19 (Decimal::FRACTIONAL\_PART\_DENOMINATOR). For an easier interface, use from\_str.

Returns

```rust
Self
```

### [](#_struct_Duration)Duration

`struct`

**Implements traits:**

*   `Clone`
    
*   `Copy`
    
*   `Debug`
    
*   `Display`
    
*   `Eq`
    
*   `From<Duration>`
    
*   `From<Duration>`
    
*   `FromStr`
    
*   `Hash`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    
*   `TryFrom<Duration>`
    

A relative duration, which contains months, days, and nanoseconds. Can be used for calendar-relative durations (eg 7 days forward), or for absolute durations using the nanosecond component When used as an absolute duration, convertible to chrono::Duration

Fields   

Name

Type

Description

`days`

`u32`

Number of calendar days in the duration.

`months`

`u32`

Number of calendar months in the duration.

`nanos`

`u64`

Number of nanoseconds in the duration.

### [](#_enum_Offset)Offset

`enum`

Offset for datetime-tz. Can be retrieved from an IANA Tz or a FixedOffset.

Enum variants 

Variant

`Fixed(FixedOffset)`

`IANA(<Tz as TimeZone>::Offset)`

### [](#_enum_TimeZone)TimeZone

`enum`

TimeZone for datetime-tz. Can be represented as an IANA Tz or as a FixedOffset.

Enum variants 

Variant

`Fixed(FixedOffset)`

`IANA(Tz)`

## [](#_analyze_header)Analyze

### [](#_struct_AnalyzedQuery)AnalyzedQuery

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

An `AnalyzedQuery` contains the server’s representation of the query and preamble functions; as well as the result of types inferred for each variable by type-inference.

Fields   

Name

Type

Description

`fetch`

`Option<Fetch>`

A representation of the `Fetch` stage of the query, if it has one

`given`

`Option<Given>`

A representation of the `Given` stage of the query, if it has one

`preamble`

`Vec<Function>`

A representation of the `Function`s in the preamble of the query

`query`

`Pipeline`

A representation of the query as a `Pipeline`

`source`

`String`

The original TypeQL query string

### [](#_enum_Comparator)Comparator

`enum`

A representation of the comparator used in a comparison constraint.

Enum variants 

Variant

`Contains = 7`

`Equal = 0`

`Greater = 4`

`GreaterOrEqual = 5`

`LessOrEqual = 3`

`LessThan = 2`

`Like = 6`

`NotEqual = 1`

#### [](#_enum_Comparator_symbol_)symbol

```rust
pub fn symbol(&self) -> &'static str
```

The symbol representing the comparator in TypeQL

Returns

```rust
&'static str
```

### [](#_struct_ConjunctionID)ConjunctionID

`struct`

**Implements traits:**

*   `Clone`
    
*   `Copy`
    
*   `Debug`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Holds the index of the conjunction in a `Pipeline`’s `conjunctions` field. Used as indirection in the representation of a pipeline.

Fields   

Name

Type

Description

`0`

`usize`

### [](#_struct_Conjunction)Conjunction

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

A representation of the constraints involved in the query, and types inferred for each variable.

Fields   

Name

Type

Description

`constraints`

`Vec<ConstraintWithSpan>`

The `Constraint`s in the conjunction.

`variable_annotations`

`HashMap<Variable, VariableAnnotations>`

The annotations of each variable in the conjunction.

### [](#_enum_Constraint)Constraint

`enum`

A representation of a TypeQL constraint.

Enum variants 

Variant

`Comparison`

`Expression`

`FunctionCall`

`Has`

`Iid`

`Is`

`Isa`

`Kind`

`Label`

`Links`

`Not`

`Or`

`Owns`

`Plays`

`Relates`

`Sub`

`Try`

`Value`

### [](#_enum_ConstraintVertex)ConstraintVertex

`enum`

The answer to a TypeDB query is a set of concepts which satisfy the <code>Constraints</code> in the query. A <code>ConstraintVertex</code> is either a variable, or some identifier of the concept.

The types inferred for <code>Variable</code>, <code>Label</code> and <code>NamedRole</code> vertices can be read from the <code>variable\_annotations</code> field of the <code>Conjunction</code> it is in.

Enum variants 

Variant

`Label(Type)`

`NamedRole(NamedRole)`

`Value(Value)`

`Variable(Variable)`

### [](#_struct_ConstraintSpan)ConstraintSpan

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

The span of a constraint in the `source` of the `AnalyzedQuery`.

Fields   

Name

Type

Description

`begin`

`usize`

The offset of the first character in the span

`end`

`usize`

The offset after the last character in the span

### [](#_enum_ConstraintExactness)ConstraintExactness

`enum`

Tells apart exact variants of constraints from the ones allowing subtype-polymorphism. e.g. <code>isa!</code> would be represented as an <code>Constraint::Isa</code> with its exactness field <code>ConstraintExactness::Exact</code>.

Enum variants 

Variant

`Exact = 0`

`Subtypes = 1`

### [](#_enum_Fetch)Fetch

`enum`

A representation of the ‘fetch’ stage of a query

Enum variants 

Variant

`Leaf(FetchLeaf)`

`List(Box<Fetch>)`

`Object(HashMap<String, Fetch>)`

### [](#_struct_FetchLeaf)FetchLeaf

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

Holds typing information about a leaf value in a `Fetch` document.

Fields   

Name

Type

Description

`annotations`

`Vec<ValueType>`

The `ValueType` this value can be.

### [](#_struct_Function)Function

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

Holds a representation of the function, and the result of type-inference for each variable.

Fields   

Name

Type

Description

`argument_annotations`

`Vec<VariableAnnotations>`

The inferred type for each argument of the function.

`argument_variables`

`Vec<Variable>`

The `Variable`s which are the arguments of the function.

`body`

`Pipeline`

A representation of the `Pipeline` which forms the body of the function.

`return_annotations`

`Vec<VariableAnnotations>`

The inferred type for each concept returned by the function.

`return_operation`

`ReturnOperation`

A representation of the `ReturnOperation` of the function.

### [](#_enum_ReturnOperation)ReturnOperation

`enum`

A representation of the return operation of the function

Enum variants 

Variant

`Check`

`Reduce`

`Single`

`Stream`

### [](#_struct_NamedRole)NamedRole

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `PartialEq`
    

A `NamedRole` vertex is used in links & relates constraints, as multiple relations may have roles with the same name.

Fields   

Name

Type

Description

`name`

`String`

`variable`

`Variable`

### [](#_struct_Pipeline)Pipeline

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

A representation of a query pipeline.

Fields   

Name

Type

Description

`conjunctions`

`Vec<Conjunction>`

A flattened list of conjunctions in the pipeline. The actual logical structure can be reconstructed from the `Constraint`s within the conjunction.

`outputs`

`Vec<Variable>`

The variables available at the end of a pipeline

`stages`

`Vec<PipelineStage>`

The stages making up the pipeline

`variable_info`

`HashMap<Variable, VariableInfo>`

General information about a variable, such as its name.

#### [](#_struct_Pipeline_variable_name_)variable\_name

```rust
pub fn variable_name(&self, variable: &Variable) -> Option<&str>
```

Retrieves the name of a variable, if it has one.

Returns

```rust
Option<&str>
```

### [](#_enum_PipelineStage)PipelineStage

`enum`

Representation of a stage in a <code>Pipeline</code>.

Enum variants 

Variant

`Delete`

`Distinct`

`Insert`

`Limit`

`Match`

`Offset`

`Put`

`Reduce`

`Require`

`Select`

`Sort`

`Update`

### [](#_struct_ReduceAssignment)ReduceAssignment

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

Representation of an assignment from a reduction in a `PipelineStage::Reduce`, such as `reduce $c = sum($x);`

Fields   

Name

Type

Description

`assigned`

`Variable`

`reducer`

`Reducer`

### [](#_struct_Reducer)Reducer

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

Representation of a reducer used either in a `PipelineStage::Reduce` or in a function’s `ReturnOperation`.

Fields   

Name

Type

Description

`arguments`

`Vec<Variable>`

The arguments to the reducer.

`reducer`

`String`

The reduce operation applied

### [](#_struct_SortVariable)SortVariable

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

The variable being sorted on and the ordering of the sort, as used in a `PipelineStage::Sort`, e.g. `sort $v desc`

Fields   

Name

Type

Description

`order`

`SortOrder`

`variable`

`Variable`

### [](#_enum_SortOrder)SortOrder

`enum`

The order of a variable being sorted on in a <code>PipelineStage::Sort</code>

Enum variants 

Variant

`Ascending = 0`

`Descending = 1`

### [](#_enum_TypeAnnotations)TypeAnnotations

`enum`

The category of a variable, and the possible types determined by type-inference.

Enum variants 

Variant

`Instance(Vec<Type>)`

`Type(Vec<Type>)`

`Value(ValueType)`

### [](#_struct_Variable)Variable

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Eq`
    
*   `Hash`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

Uniquely identifies a variable in a `Pipeline`pipeline. Its name (if any) can be retrieved from the `variable_names` field in `Pipeline`

Fields   

Name

Type

Description

`0`

`u32`

### [](#_struct_VariableAnnotations)VariableAnnotations

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

Fields   

Name

Type

Description

`types`

`TypeAnnotations`

The `TypeAnnotations` of this variable.

### [](#_struct_VariableInfo)VariableInfo

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    

Holds information about variables in a `Pipeline`.

Fields   

Name

Type

Description

`name`

`String`

The name of the variable, if any.

## [](#_errors_header)Errors

### [](#_enum_Error)Error

`enum`

Represents errors encountered during operation.

Enum variants 

Variant

`Analyze(AnalyzeError)`

`Concept(ConceptError)`

`Connection(ConnectionError)`

`FFI(String)`

`Internal(InternalError)`

`Migration(MigrationError)`

`Other(String)`

`Query(QueryError)`

`Server(ServerError)`

### [](#_enum_ConnectionError)ConnectionError

`enum`

Enum variants 

Variant

`AbsentTlsConfigForTlsConnection`

`AnalyzeNoResponse`

`BrokenPipe`

`ClusterServerNotPrimary`

`ConnectionRefusedNetworking`

`DatabaseExportChannelIsClosed`

`DatabaseExportStreamNoResponse`

`DatabaseImportChannelIsClosed`

`DatabaseImportStreamUnexpectedResponse`

`EncryptionSettingsMismatch`

`ListsNotImplemented`

`MissingPort`

`MissingResponseField`

`NoPrimaryServer`

`QueryStreamNoResponse`

`RPCMethodUnavailable`

`RequestTimeout`

`SchemeTlsSettingsMismatch`

`ServerConnectionFailed`

`ServerConnectionFailedNetworking`

`ServerConnectionFailedWithError`

`ServerConnectionIsClosed`

`ServerConnectionIsClosedUnexpectedly`

`ServerIsNotInitialised`

`SslCertificateNotValidated`

`TokenCredentialInvalid`

`TransactionIsClosed`

`TransactionIsClosedWithErrors`

`UnexpectedConnectionClose`

`UnexpectedKind`

`UnexpectedQueryType`

`UnexpectedResponse`

`UnexpectedServerReplicationRole`

`UnknownDirectServerRouting`

`UnknownRequestId`

`ValueStructNotImplemented`

`ValueTimeZoneNameNotRecognised`

`ValueTimeZoneOffsetNotRecognised`

### [](#_struct_ServerError)ServerError

`struct`

**Implements traits:**

*   `Clone`
    
*   `Debug`
    
*   `Display`
    
*   `Eq`
    
*   `From<ServerError>`
    
*   `PartialEq`
    
*   `StructuralPartialEq`
    

### [](#_struct_DurationParseError)DurationParseError

`struct`

**Implements traits:**

*   `Debug`
    

### [](#_enum_InternalError)InternalError

`enum`

Enum variants 

Variant

`RecvError`

`SendError`

`UnexpectedRequestType`

`UnexpectedResponseType`

`Unimplemented`

[Java gRPC driver](../java/index.md) [C gRPC driver](../c/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/reference/modules/ROOT/pages/typedb-grpc-drivers/rust.adoc) Edit this page on GitHub.