pub struct Comment<'a> {
pub timestamp: u32,
pub marker_id: MarkerId,
pub text: &'a [u8],
}
Expand description
Comment data.
Fields§
§timestamp: u32
The timestamp of the comment. The value 0 usually means that no timestamp has been set.
The value is the number of seconds since January 1, 1904.
The unix_timestamp()
and
set_unix_timestamp()
methods can be used to manipulate
this value as a UNIX timestamp.
marker_id: MarkerId
Optional marker id for the comment. The value 0 means that there is no marker associated with the comment. The value should be a positive number, but there isn’t any validation for it.
If comments with non-zero marker ids are written to a stream, then also markers with the same marker ids should be written.
text: &'a [u8]
Text of the comment. The maximum length is 65535 bytes.
Implementations§
Source§impl Comment<'_>
impl Comment<'_>
Sourcepub fn unix_timestamp(&self) -> i64
pub fn unix_timestamp(&self) -> i64
Returns the comment timestamp (relative to 1904-01-01T00:00:00) as a UNIX timestamp (relative to 1970-01-01T00:00:00). The result can be a positive or a negative value.
Sourcepub fn set_unix_timestamp(&mut self, unix_timestamp: i64) -> AifcResult<()>
pub fn set_unix_timestamp(&mut self, unix_timestamp: i64) -> AifcResult<()>
Sets the comment timestamp (relative to 1904-01-01T00:00:00) to
a UNIX timestamp (relative to 1970-01-01T00:00:00).
If the UNIX timestamp is outside the bounds of the comment timestamp,
the TimestampOutOfBounds
error is returned.
Sourcepub fn write_chunk_data(
write: &mut dyn Write,
comments: &[Comment<'_>],
) -> AifcResult<()>
pub fn write_chunk_data( write: &mut dyn Write, comments: &[Comment<'_>], ) -> AifcResult<()>
Writes the given comments to the given write stream. The maximum comment count is 65535. The first bytes written contains the comment count.
Sourcepub fn chunk_data_size(comments: &[Comment<'_>]) -> AifcResult<u32>
pub fn chunk_data_size(comments: &[Comment<'_>]) -> AifcResult<u32>
Returns the byte size of the comment chunk for the given comments.