Struct worker_plus::Bucket
source · pub struct Bucket { /* private fields */ }
Expand description
An instance of the R2 bucket binding.
Implementations§
source§impl Bucket
impl Bucket
sourcepub async fn head(&self, key: impl Into<String>) -> Result<Option<Object>>
pub async fn head(&self, key: impl Into<String>) -> Result<Option<Object>>
Retrieves the Object for the given key containing only object metadata, if the key exists.
sourcepub fn get(&self, key: impl Into<String>) -> GetOptionsBuilder<'_>
pub fn get(&self, key: impl Into<String>) -> GetOptionsBuilder<'_>
sourcepub fn put(
&self,
key: impl Into<String>,
value: impl Into<Data>
) -> PutOptionsBuilder<'_>
pub fn put(
&self,
key: impl Into<String>,
value: impl Into<Data>
) -> PutOptionsBuilder<'_>
Stores the given value
and metadata under the associated key
. Once the write succeeds,
returns an Object containing metadata about the stored Object.
R2 writes are strongly consistent. Once the future resolves, all subsequent read operations will see this key value pair globally.
sourcepub async fn delete(&self, key: impl Into<String>) -> Result<()>
pub async fn delete(&self, key: impl Into<String>) -> Result<()>
Deletes the given value and metadata under the associated key. Once the delete succeeds, returns void.
R2 deletes are strongly consistent. Once the Promise resolves, all subsequent read operations will no longer see this key value pair globally.
sourcepub fn list(&self) -> ListOptionsBuilder<'_>
pub fn list(&self) -> ListOptionsBuilder<'_>
Trait Implementations§
source§impl JsCast for Bucket
impl JsCast for Bucket
source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
Performs a dynamic
instanceof
check to see whether the JsValue
provided is an instance of this type. Read moresource§fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js(val: JsValue) -> Self
source§fn unchecked_from_js_ref(val: &JsValue) -> &Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere
T: JsCast,
Test whether this JS value has a type
T
. Read moresource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
Performs a dynamic cast (checked at runtime) of this value into the
target type
T
. Read moresource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
Performs a dynamic cast (checked at runtime) of this value into the
target type
T
. Read moresource§fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_into<T>(self) -> Twhere
T: JsCast,
Performs a zero-cost unchecked cast into the specified type. Read more
source§fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
Performs a zero-cost unchecked cast into a reference to the specified
type. Read more