Skip to content

Commit

Permalink
💥 Change EntryBuilder::build return type impl Entry to `RegularEn…
Browse files Browse the repository at this point in the history
…try`
  • Loading branch information
ChanTsune committed Nov 18, 2023
1 parent f347847 commit 5b797cf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/src/archive/entry/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{

const MAX_CHUNK_DATA_LENGTH: usize = u32::MAX as usize;

/// A builder for creating a new [Entry].
/// A builder for creating a new [RegularEntry].
pub struct EntryBuilder {
header: EntryHeader,
phsf: Option<String>,
Expand Down Expand Up @@ -192,17 +192,12 @@ impl EntryBuilder {
self
}

/// Builds the entry and returns a Result containing the new [Entry].
/// Builds the entry and returns a Result containing the new [RegularEntry].
///
/// # Returns
///
/// A Result containing the new [Entry], or an I/O error if the build fails.
#[inline]
pub fn build(self) -> io::Result<impl Entry> {
Ok(EntryContainer::Regular(self.build_as_entry()?))
}

fn build_as_entry(self) -> io::Result<RegularEntry> {
/// A Result containing the new [RegularEntry], or an I/O error if the build fails.
pub fn build(self) -> io::Result<RegularEntry> {
let data = if let Some(data) = self.data {
data.try_into_inner()?.try_into_inner()?.inner
} else {
Expand Down

0 comments on commit 5b797cf

Please sign in to comment.