Merge pull request #10 from jstarks/relax_static

Relax static lifetime bounds
This commit is contained in:
sivadeilra 2021-04-20 18:01:24 -07:00 коммит произвёл GitHub
Родитель 5ba52a85c9 28a831a8bd
Коммит 3694a33dc3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 9 добавлений и 11 удалений

Просмотреть файл

@ -68,10 +68,14 @@ impl EventDataDescriptor<'static> {
phantom_ref: PhantomData,
}
}
}
const EVENT_DATA_DESCRIPTOR_TYPE_PROVIDER_METADATA: u32 = 2;
const EVENT_DATA_DESCRIPTOR_TYPE_EVENT_METADATA: u32 = 1;
impl<'a> EventDataDescriptor<'a> {
/// Creates an `EventDataDescriptor` for provider metadata.
/// Provider metadata is required to have `'static` lifetime.
pub fn for_provider_metadata(s: &'static [u8]) -> Self {
pub fn for_provider_metadata(s: &'a [u8]) -> Self {
Self {
ptr: s.as_ptr() as usize as u64,
size: s.len() as u32,
@ -81,8 +85,7 @@ impl EventDataDescriptor<'static> {
}
/// Creates an `EventDataDescriptor` for the metadata that describes a single event.
/// Event metadata is required to have `'static` lifetime.
pub fn for_event_metadata(s: &'static [u8]) -> Self {
pub fn for_event_metadata(s: &'a [u8]) -> Self {
Self {
ptr: s.as_ptr() as usize as u64,
size: s.len() as u32,
@ -90,12 +93,7 @@ impl EventDataDescriptor<'static> {
phantom_ref: PhantomData,
}
}
}
const EVENT_DATA_DESCRIPTOR_TYPE_PROVIDER_METADATA: u32 = 2;
const EVENT_DATA_DESCRIPTOR_TYPE_EVENT_METADATA: u32 = 1;
impl<'a> EventDataDescriptor<'a> {
/// Creates a `EventDataDescriptor for a slice of bytes.
pub fn for_bytes(s: &'a [u8]) -> Self {
Self {

Просмотреть файл

@ -296,8 +296,8 @@ impl EtwProvider {
/// See TraceLoggingRegisterEx in traceloggingprovider.h.
/// This registers provider metadata.
pub fn register_provider_metadata(
&mut self,
provider_metadata: &'static [u8],
&mut self,
provider_metadata: &[u8],
) -> Result<(), Error> {
#[cfg(target_os = "windows")]
{