Skip to content

Commit

Permalink
fix: pass placeholders as mutable slice
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-nick committed May 31, 2024
1 parent 25eb9bc commit 6624bdd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/command/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ impl Command for Update<'_> {

/// Create placeholder files/directories.
#[derive(Debug)]
pub struct CreatePlaceholders {
pub struct CreatePlaceholders<'a> {
/// The placeholders to create.
pub placeholders: Vec<PlaceholderFile>,
pub placeholders: &'a mut [PlaceholderFile],
/// The total amount of placeholders that are a child of the current directory.
pub total: u64,
}

impl Command for CreatePlaceholders {
impl Command for CreatePlaceholders<'_> {
const OPERATION: CF_OPERATION_TYPE = CloudFilters::CF_OPERATION_TYPE_TRANSFER_PLACEHOLDERS;

type Result = Vec<core::Result<Usn>>;
Expand Down Expand Up @@ -203,7 +203,7 @@ impl Command for CreatePlaceholders {
}
}

impl Fallible for CreatePlaceholders {
impl Fallible for CreatePlaceholders<'_> {
fn fail(
connection_key: RawConnectionKey,
transfer_key: RawTransferKey,
Expand Down
2 changes: 1 addition & 1 deletion src/filter/ticket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl FetchPlaceholders {
/// The value returned is the final [Usn][crate::Usn] (and if they succeeded) after each placeholder is created.
pub fn pass_with_placeholder(
&self,
placeholders: Vec<PlaceholderFile>,
placeholders: &mut [PlaceholderFile],
) -> core::Result<Vec<core::Result<Usn>>> {
command::CreatePlaceholders {
total: placeholders.len() as _,
Expand Down
12 changes: 6 additions & 6 deletions src/placeholder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,7 @@ pub struct UpdateOptions<'a>(Update<'a>);
impl<'a> UpdateOptions<'a> {
/// Create a new [UpdateOptions][crate::UpdateOptions].
pub fn new() -> Self {
Self(Update {
mark_sync: false,
metadata: None,
blob: None,
})
Self::default()
}

/// Marks the placeholder as synced.
Expand Down Expand Up @@ -309,7 +305,11 @@ impl<'a> UpdateOptions<'a> {

impl<'a> Default for UpdateOptions<'a> {
fn default() -> Self {
Self::new()
Self(Update {
mark_sync: false,
metadata: None,
blob: None,
})
}
}

Expand Down

0 comments on commit 6624bdd

Please sign in to comment.