Page MenuHomePhabricator

D8889.id30137.diff
No OneTemporary

D8889.id30137.diff

diff --git a/services/comm-services-lib/src/blob/client.rs b/services/comm-services-lib/src/blob/client.rs
--- a/services/comm-services-lib/src/blob/client.rs
+++ b/services/comm-services-lib/src/blob/client.rs
@@ -72,6 +72,9 @@
///
/// # Example
/// ```rust
+ /// # use comm_services_lib::blob::client::*;
+ /// # use futures_util::stream::TryStreamExt;
+ /// # async fn f() -> anyhow::Result<()> {
/// let client =
/// BlobServiceClient::new("http://localhost:50053".parse()?);
///
@@ -79,6 +82,8 @@
/// while let Some(data) = stream.try_next().await? {
/// println!("Got data: {:?}", data);
/// }
+ /// # Ok(())
+ /// # }
/// ```
pub async fn get(
&self,
@@ -182,8 +187,9 @@
///
/// # Example
/// ```rust
+ /// # use comm_services_lib::blob::client::*;
/// use std::io::{Error, ErrorKind};
- ///
+ /// # async fn f() -> anyhow::Result<()> {
/// let client =
/// BlobServiceClient::new("http://localhost:50053".parse()?);
///
@@ -192,7 +198,11 @@
/// yield Ok(vec![4, 5, 6]);
/// yield Err(Error::new(ErrorKind::Other, "Oops"));
/// };
+ ///
+ /// # let blob_hash = "hash".to_string();
/// client.upload_blob(&blob_hash, stream).await?;
+ /// # Ok(())
+ /// # }
/// ```
pub async fn upload_blob<H, S>(
&self,
diff --git a/services/comm-services-lib/src/database.rs b/services/comm-services-lib/src/database.rs
--- a/services/comm-services-lib/src/database.rs
+++ b/services/comm-services-lib/src/database.rs
@@ -66,13 +66,15 @@
/// Conversion trait for [`AttributeValue`]
///
/// Types implementing this trait are able to do the following:
-/// ```rust
+/// ```
/// use comm_services_lib::database::{TryFromAttribute, AttributeTryInto};
-///
-/// let foo = SomeType::try_from_attr("MyAttribute", Some(attribute));
+/// # let attribute = aws_sdk_dynamodb::types::AttributeValue::S("a".to_string());
+/// let foo = String::try_from_attr("MyAttribute", Some(attribute))?;
///
/// // if `AttributeTryInto` is imported, also:
-/// let bar = Some(attribute).attr_try_into("MyAttribute");
+/// # let attribute = aws_sdk_dynamodb::types::AttributeValue::S("a".to_string());
+/// let bar: String = Some(attribute).attr_try_into("MyAttribute")?;
+/// # Ok::<(), comm_services_lib::database::DBItemError>(())
pub trait TryFromAttribute: Sized {
fn try_from_attr(
attribute_name: impl Into<String>,

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 1:02 AM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2598885
Default Alt Text
D8889.id30137.diff (2 KB)

Event Timeline