@@ -242,13 +242,18 @@ impl Table {
242242 ///
243243 /// # Examples
244244 ///
245- /// ```rust
245+ /// ```no_run
246+ /// # use perspective_client::{Client, TableData, TableInitOptions, UpdateData};
247+ /// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
248+ /// # let client: Client = todo!();
246249 /// let options = TableInitOptions {
247250 /// index: Some("x".to_string()),
248- /// ..default()
251+ /// ..TableInitOptions:: default()
249252 /// };
250- /// let table = client.table("x,y\n1,2\n3,4", options).await;
251- /// let index = table.get_index()
253+ /// let data = TableData::Update(UpdateData::Csv("x,y\n1,2\n3,4".into()));
254+ /// let table = client.table(data, options).await?;
255+ /// let index = table.get_index();
256+ /// # Ok(()) }
252257 /// ```
253258 pub fn get_index ( & self ) -> Option < String > {
254259 self . options . index . as_ref ( ) . map ( |index| index. to_owned ( ) )
@@ -294,14 +299,18 @@ impl Table {
294299 ///
295300 /// # Examples
296301 ///
297- /// ```rust
302+ /// ```no_run
303+ /// # use perspective_client::{Client, DeleteOptions, TableData, TableInitOptions, UpdateData};
304+ /// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
305+ /// # let client: Client = todo!();
298306 /// let opts = TableInitOptions::default();
299307 /// let data = TableData::Update(UpdateData::Csv("x,y\n1,2\n3,4".into()));
300308 /// let table = client.table(data, opts).await?;
301309 ///
302310 /// // ...
303311 ///
304312 /// table.delete(DeleteOptions::default()).await?;
313+ /// # Ok(()) }
305314 /// ```
306315 pub async fn delete ( & self , options : DeleteOptions ) -> ClientResult < ( ) > {
307316 let msg = self . client_message ( ClientReq :: TableDeleteReq ( TableDeleteReq {
@@ -319,8 +328,12 @@ impl Table {
319328 ///
320329 /// # Examples
321330 ///
322- /// ```rust
323- /// let columns = table.columns().await;
331+ /// ```no_run
332+ /// # use perspective_client::Table;
333+ /// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
334+ /// # let table: Table = todo!();
335+ /// let columns = table.columns().await?;
336+ /// # Ok(()) }
324337 /// ```
325338 pub async fn columns ( & self ) -> ClientResult < Vec < String > > {
326339 let msg = self . client_message ( ClientReq :: TableSchemaReq ( TableSchemaReq { } ) ) ;
@@ -430,8 +443,14 @@ impl Table {
430443 ///
431444 /// # Examples
432445 ///
433- /// ```rust
434- /// table.remove(UpdateData::Csv("index\n1\n2\n3")).await?;
446+ /// ```no_run
447+ /// # use perspective_client::{Table, UpdateData};
448+ /// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
449+ /// # let table: Table = todo!();
450+ /// table
451+ /// .remove(UpdateData::Csv("index\n1\n2\n3".into()))
452+ /// .await?;
453+ /// # Ok(()) }
435454 /// ```
436455 pub async fn remove ( & self , input : UpdateData ) -> ClientResult < ( ) > {
437456 let msg = self . client_message ( ClientReq :: TableRemoveReq ( TableRemoveReq {
@@ -457,10 +476,13 @@ impl Table {
457476 ///
458477 /// # Examples
459478 ///
460- /// ```rust
479+ /// ```no_run
480+ /// # use perspective_client::{Table, UpdateData};
481+ /// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
482+ /// # let table: Table = todo!();
461483 /// let data = UpdateData::Csv("x,y\n1,2".into());
462- /// let opts = UpdateOptions::default() ;
463- /// table.replace(data, opts).await?;
484+ /// table.replace(data).await? ;
485+ /// # Ok(()) }
464486 /// ```
465487 pub async fn replace ( & self , input : UpdateData ) -> ClientResult < ( ) > {
466488 let msg = self . client_message ( ClientReq :: TableReplaceReq ( TableReplaceReq {
@@ -491,11 +513,15 @@ impl Table {
491513 ///
492514 /// # Examples
493515 ///
494- /// ```rust
516+ /// ```no_run
517+ /// # use perspective_client::{Table, UpdateData, UpdateOptions};
518+ /// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
519+ /// # let table: Table = todo!();
495520 /// let data = UpdateData::Csv("x,y\n1,2".into());
496521 /// let opts = UpdateOptions::default();
497522 /// table.update(data, opts).await?;
498- /// ```
523+ /// # Ok(()) }
524+ /// ```
499525 pub async fn update ( & self , input : UpdateData , options : UpdateOptions ) -> ClientResult < ( ) > {
500526 let msg = self . client_message ( ClientReq :: TableUpdateReq ( TableUpdateReq {
501527 data : Some ( input. into ( ) ) ,
@@ -538,8 +564,12 @@ impl Table {
538564 ///
539565 /// # Examples
540566 ///
541- /// ```rust
542- /// use crate::config::*;
567+ /// ```no_run
568+ /// # use std::collections::HashMap;
569+ /// # use perspective_client::Table;
570+ /// # use perspective_client::config::*;
571+ /// # async fn run() -> Result<(), Box<dyn std::error::Error>> {
572+ /// # let table: Table = todo!();
543573 /// let view = table
544574 /// .view(Some(ViewConfigUpdate {
545575 /// columns: Some(vec![Some("Sales".into())]),
@@ -552,6 +582,7 @@ impl Table {
552582 /// ..ViewConfigUpdate::default()
553583 /// }))
554584 /// .await?;
585+ /// # Ok(()) }
555586 /// ```
556587 pub async fn view ( & self , config : Option < ViewConfigUpdate > ) -> ClientResult < View > {
557588 let view_name = randid ( ) ;
0 commit comments