Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change RecordLocation members lifetime - log 0.4 support #171

Merged
merged 2 commits into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ slog-async = "2"

[package.metadata.docs.rs]
features = ["std", "nested-values", "dynamic-keys"]

[patch.crates-io]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to go if this is to be landed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I know, just wanted to make whole code build.

slog-async = { git = "https://github.com/jacekchmiel/slog-async", branch = "log-0.4-support" }
24 changes: 12 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2265,17 +2265,17 @@ fn level_from_str() {
// {{{ Record
#[doc(hidden)]
#[derive(Clone, Copy)]
pub struct RecordLocation {
pub struct RecordLocation<'a> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is going to be a breaking change. :/

/// File
pub file: &'static str,
pub file: &'a str,
/// Line
pub line: u32,
/// Column (currently not implemented)
pub column: u32,
/// Function (currently not implemented)
pub function: &'static str,
pub function: &'a str,
/// Module
pub module: &'static str,
pub module: &'a str,
}
#[doc(hidden)]
/// Information that can be static in the given record thus allowing to optimize
Expand All @@ -2285,7 +2285,7 @@ pub struct RecordLocation {
/// instead.
pub struct RecordStatic<'a> {
/// Code location
pub location: &'a RecordLocation,
pub location: &'a RecordLocation<'a>,
/// Tag
pub tag: &'a str,
/// Logging level
Expand Down Expand Up @@ -2313,14 +2313,14 @@ impl<'a> Record<'a> {
#[inline]
#[doc(hidden)]
pub fn new(
s: &'a RecordStatic<'a>,
rstatic: &'a RecordStatic<'a>,
msg: &'a fmt::Arguments<'a>,
kv: BorrowedKV<'a>,
) -> Self {
Record {
rstatic: s,
msg: msg,
kv: kv,
rstatic,
msg,
kv,
}
}

Expand Down Expand Up @@ -2350,7 +2350,7 @@ impl<'a> Record<'a> {
}

/// Get file path
pub fn file(&self) -> &'static str {
pub fn file(&self) -> &'a str {
self.rstatic.location.file
}

Expand All @@ -2368,7 +2368,7 @@ impl<'a> Record<'a> {
}

/// Get module
pub fn module(&self) -> &'static str {
pub fn module(&self) -> &'a str {
self.rstatic.location.module
}

Expand All @@ -2379,7 +2379,7 @@ impl<'a> Record<'a> {
///
/// It will be implemented at first opportunity, and
/// it will not be considered a breaking change.
pub fn function(&self) -> &'static str {
pub fn function(&self) -> &'a str {
self.rstatic.location.function
}

Expand Down