From f748a596b1b775e69aa7c0cf2293ae9504bfed32 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 18 Mar 2025 22:09:04 -0400 Subject: [PATCH] fix: Rust doc fix --- crates/examples/src/rest_catalog_namespace.rs | 6 ++++++ crates/examples/src/rest_catalog_table.rs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/crates/examples/src/rest_catalog_namespace.rs b/crates/examples/src/rest_catalog_namespace.rs index 8b6e12a53..04cad54fa 100644 --- a/crates/examples/src/rest_catalog_namespace.rs +++ b/crates/examples/src/rest_catalog_namespace.rs @@ -31,19 +31,24 @@ static REST_URI: &str = "http://localhost:8181"; /// [quickstart documentation](https://iceberg.apache.org/spark-quickstart/). #[tokio::main] async fn main() { + // ANCHOR: create_catalog // Create the REST iceberg catalog. let config = RestCatalogConfig::builder() .uri(REST_URI.to_string()) .build(); let catalog = RestCatalog::new(config); + // ANCHOR_END: create_catalog + // ANCHOR: list_all_namespace // List all namespaces already in the catalog. let existing_namespaces = catalog.list_namespaces(None).await.unwrap(); println!( "Namespaces alreading in the existing catalog: {:?}", existing_namespaces ); + // ANCHOR_END: list_all_namespace + // ANCHOR: create_namespace // Create a new namespace identifier. let namespace_ident = NamespaceIdent::from_vec(vec!["ns1".to_string(), "ns11".to_string()]).unwrap(); @@ -66,4 +71,5 @@ async fn main() { let loaded_namespace = catalog.get_namespace(&namespace_ident).await.unwrap(); println!("Namespace loaded!\n\nNamespace: {:#?}", loaded_namespace,); + // ANCHOR_END: create_namespace } diff --git a/crates/examples/src/rest_catalog_table.rs b/crates/examples/src/rest_catalog_table.rs index 6b8a75c4b..25ef9d9ac 100644 --- a/crates/examples/src/rest_catalog_table.rs +++ b/crates/examples/src/rest_catalog_table.rs @@ -40,6 +40,7 @@ async fn main() { .build(); let catalog = RestCatalog::new(config); + // ANCHOR: create_table // Create the table identifier. let namespace_ident = NamespaceIdent::from_vec(vec![NAMESPACE.to_string()]).unwrap(); let table_ident = TableIdent::new(namespace_ident.clone(), TABLE_NAME.to_string()); @@ -78,7 +79,9 @@ async fn main() { .await .unwrap(); println!("Table {TABLE_NAME} created!"); + // ANCHOR_END: create_table + // ANCHOR: load_table // Ensure that the table is under the correct namespace. assert!(catalog .list_tables(&namespace_ident) @@ -89,4 +92,5 @@ async fn main() { // Load the table back from the catalog. It should be identical to the created table. let loaded_table = catalog.load_table(&table_ident).await.unwrap(); println!("Table {TABLE_NAME} loaded!\n\nTable: {:?}", loaded_table); + // ANCHOR_END: load_table }