mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2025-01-21 00:23:55 +00:00
ogg_pager: Remove Page::new
This commit is contained in:
parent
83e21b63bb
commit
cbe865dade
2 changed files with 4 additions and 42 deletions
|
@ -21,6 +21,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
spec-compliant and efficient.
|
spec-compliant and efficient.
|
||||||
- **ogg_pager**: Most fields in `Page` have been separated out into the new `PageHeader` struct.
|
- **ogg_pager**: Most fields in `Page` have been separated out into the new `PageHeader` struct.
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- **ogg_pager**: Removed `Page::new`, now pages can only be created through `ogg_pager::paginate` or
|
||||||
|
`Packets::paginate`.
|
||||||
|
|
||||||
## [0.9.0] - 2022-10-30
|
## [0.9.0] - 2022-10-30
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -29,48 +29,6 @@ pub struct Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Page {
|
impl Page {
|
||||||
/// Create a new `Page`
|
|
||||||
///
|
|
||||||
/// This will have the following defaults:
|
|
||||||
///
|
|
||||||
/// * `checksum` = 0
|
|
||||||
/// * `start` = 0
|
|
||||||
/// * `end` = `content.len()`
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// `content.len()` > [`MAX_CONTENT_SIZE`]
|
|
||||||
///
|
|
||||||
/// # Example
|
|
||||||
///
|
|
||||||
/// ```rust,ignore
|
|
||||||
/// use ogg_pager::CONTAINS_FIRST_PAGE_OF_BITSTREAM;
|
|
||||||
///
|
|
||||||
/// // Creating the identification header
|
|
||||||
/// let ident_header_packet = vec![...];
|
|
||||||
/// let stream_serial_number = 2784419176;
|
|
||||||
///
|
|
||||||
/// let page = Page::new(
|
|
||||||
/// CONTAINS_FIRST_PAGE_OF_BITSTREAM,
|
|
||||||
/// 0,
|
|
||||||
/// stream_serial_number,
|
|
||||||
/// ident_header_packet,
|
|
||||||
/// );
|
|
||||||
/// ```
|
|
||||||
pub fn new(header: PageHeader, content: Vec<u8>) -> Result<Self> {
|
|
||||||
let content_len = content.len();
|
|
||||||
|
|
||||||
if content_len > MAX_CONTENT_SIZE {
|
|
||||||
return Err(PageError::TooMuchData);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Self {
|
|
||||||
content,
|
|
||||||
header,
|
|
||||||
end: content_len as u64,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns a reference to the `Page`'s header
|
/// Returns a reference to the `Page`'s header
|
||||||
pub fn header(&self) -> &PageHeader {
|
pub fn header(&self) -> &PageHeader {
|
||||||
&self.header
|
&self.header
|
||||||
|
|
Loading…
Reference in a new issue