Skip to content

Commit 7afd134

Browse files
authored
Add .bytes() fn to BlockId (#1157)
1 parent 3de510c commit 7afd134

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sdk/storage_blobs/src/options/block_id.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
use azure_core::AppendToUrlQuery;
22
use bytes::Bytes;
33

4+
/// Struct wrapping the bytes of a block blob block-id,
5+
///
6+
/// A block id cannot exceed 64 bytes before encoding. In addition all block id's in a block list must be the same length.
7+
/// Reference: https://learn.microsoft.com/en-us/rest/api/storageservices/put-block#uri-parameters
8+
///
49
#[derive(Debug, Clone, PartialEq, Eq)]
510
pub struct BlockId(Bytes);
611

712
impl BlockId {
13+
/// Returns a new block id,
14+
///
815
pub fn new(block_id: impl Into<Bytes>) -> Self {
916
Self(block_id.into())
1017
}
18+
19+
/// Returns clone of bytes,
20+
///
21+
pub fn bytes(&self) -> Bytes {
22+
self.0.clone()
23+
}
1124
}
1225

1326
impl AppendToUrlQuery for BlockId {

0 commit comments

Comments
 (0)