Skip to content

Commit

Permalink
add documentation about lifetime
Browse files Browse the repository at this point in the history
  • Loading branch information
astraw committed Oct 6, 2022
1 parent 770edec commit 8b9c9f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tz_macos.rs
Expand Up @@ -54,6 +54,10 @@ mod system_time_zone {
}
}

/// Get the time zone name as a [super::string_ref::StringRef].
///
/// The lifetime of the `StringRef` is bound to our lifetime. Mutable
/// access is also prevented by taking a reference to `self`.
pub(crate) fn name(&self) -> Option<super::string_ref::StringRef<Self>> {
// SAFETY: `SystemTimeZone` is only ever created with a valid `CFTimeZoneRef`.
let string = unsafe { CFTimeZoneGetName(self.0) };
Expand Down

0 comments on commit 8b9c9f0

Please sign in to comment.