pub struct ReadObject { /* private fields */ }Expand description
The request builder for Storage::read_object calls.
§Example
use google_cloud_storage::builder::storage::ReadObject;
let builder: ReadObject = client.read_object("projects/_/buckets/my-bucket", "my-object");
let contents = builder.send().await?.all_bytes().await?;
println!("object contents={contents:?}");Implementations§
Source§impl ReadObject
impl ReadObject
Sourcepub fn with_generation<T: Into<i64>>(self, v: T) -> Self
pub fn with_generation<T: Into<i64>>(self, v: T) -> Self
If present, selects a specific revision of this object (as opposed to the latest version, the default).
Sourcepub fn with_if_generation_match<T>(self, v: T) -> Self
pub fn with_if_generation_match<T>(self, v: T) -> Self
Makes the operation conditional on whether the object’s current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.
Sourcepub fn with_if_generation_not_match<T>(self, v: T) -> Self
pub fn with_if_generation_not_match<T>(self, v: T) -> Self
Makes the operation conditional on whether the object’s live generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.
Sourcepub fn with_if_metageneration_match<T>(self, v: T) -> Self
pub fn with_if_metageneration_match<T>(self, v: T) -> Self
Makes the operation conditional on whether the object’s current metageneration matches the given value.
Sourcepub fn with_if_metageneration_not_match<T>(self, v: T) -> Self
pub fn with_if_metageneration_not_match<T>(self, v: T) -> Self
Makes the operation conditional on whether the object’s current metageneration does not match the given value.
Sourcepub fn with_read_offset<T>(self, v: T) -> Self
pub fn with_read_offset<T>(self, v: T) -> Self
The offset for the first byte to return in the read, relative to the start of the object.
A negative read_offset value will be interpreted as the number of bytes
back from the end of the object to be returned.
§Examples
Read starting at 100 bytes to end of file.
let response = client
.read_object("projects/_/buckets/my-bucket", "my-object")
.with_read_offset(100)
.send()
.await?;
println!("response details={response:?}");Read last 100 bytes of file:
let response = client
.read_object("projects/_/buckets/my-bucket", "my-object")
.with_read_offset(-100)
.send()
.await?;
println!("response details={response:?}");Read bytes 1000 to 1099.
let response = client
.read_object("projects/_/buckets/my-bucket", "my-object")
.with_read_offset(1000)
.with_read_limit(100)
.send()
.await?;
println!("response details={response:?}");Sourcepub fn with_read_limit<T>(self, v: T) -> Self
pub fn with_read_limit<T>(self, v: T) -> Self
The maximum number of data bytes the server is allowed to
return.
A read_limit of zero indicates that there is no limit,
and a negative read_limit will cause an error.
§Examples:
Read first 100 bytes.
let response = client
.read_object("projects/_/buckets/my-bucket", "my-object")
.with_read_limit(100)
.send()
.await?;
println!("response details={response:?}");Read bytes 1000 to 1099.
let response = client
.read_object("projects/_/buckets/my-bucket", "my-object")
.with_read_offset(1000)
.with_read_limit(100)
.send()
.await?;
println!("response details={response:?}");Sourcepub fn with_key(self, v: KeyAes256) -> Self
pub fn with_key(self, v: KeyAes256) -> Self
The encryption key used with the Customer-Supplied Encryption Keys feature. In raw bytes format (not base64-encoded).
Example:
let key: &[u8] = &[97; 32];
let response = client
.read_object("projects/_/buckets/my-bucket", "my-object")
.with_key(KeyAes256::new(key)?)
.send()
.await?;
println!("response details={response:?}");Auto Trait Implementations§
impl !Freeze for ReadObject
impl !RefUnwindSafe for ReadObject
impl Send for ReadObject
impl Sync for ReadObject
impl Unpin for ReadObject
impl !UnwindSafe for ReadObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request