File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -976,7 +976,7 @@ impl GetOptions {
976976 /// Returns an error if the modification conditions on this request are not satisfied
977977 ///
978978 /// <https://datatracker.ietf.org/doc/html/rfc7232#section-6>
979- fn check_preconditions ( & self , meta : & ObjectMeta ) -> Result < ( ) > {
979+ pub fn check_preconditions ( & self , meta : & ObjectMeta ) -> Result < ( ) > {
980980 // The use of the invalid etag "*" means no ETag is equivalent to never matching
981981 let etag = meta. e_tag . as_deref ( ) . unwrap_or ( "*" ) ;
982982 let last_modified = meta. last_modified ;
Original file line number Diff line number Diff line change @@ -208,7 +208,8 @@ pub enum GetRange {
208208}
209209
210210#[ derive( Debug , thiserror:: Error ) ]
211- pub ( crate ) enum InvalidGetRange {
211+ #[ non_exhaustive]
212+ pub enum InvalidGetRange {
212213 #[ error( "Wanted range starting at {requested}, but object was only {length} bytes long" ) ]
213214 StartTooLarge { requested : u64 , length : u64 } ,
214215
@@ -220,7 +221,8 @@ pub(crate) enum InvalidGetRange {
220221}
221222
222223impl GetRange {
223- pub ( crate ) fn is_valid ( & self ) -> Result < ( ) , InvalidGetRange > {
224+ /// Check if the range is valid.
225+ pub fn is_valid ( & self ) -> Result < ( ) , InvalidGetRange > {
224226 if let Self :: Bounded ( r) = self {
225227 if r. end <= r. start {
226228 return Err ( InvalidGetRange :: Inconsistent {
@@ -238,8 +240,8 @@ impl GetRange {
238240 Ok ( ( ) )
239241 }
240242
241- /// Convert to a [`Range`] if valid.
242- pub ( crate ) fn as_range ( & self , len : u64 ) -> Result < Range < u64 > , InvalidGetRange > {
243+ /// Convert to a [`Range`] if [ valid](Self::is_valid) .
244+ pub fn as_range ( & self , len : u64 ) -> Result < Range < u64 > , InvalidGetRange > {
243245 self . is_valid ( ) ?;
244246 match self {
245247 Self :: Bounded ( r) => {
You can’t perform that action at this time.
0 commit comments