@@ -3,7 +3,7 @@ use crate::ffi::array_to_iovecs;
3
3
use crate :: ffi:: journal as ffi;
4
4
use crate :: id128:: Id128 ;
5
5
use cstr_argument:: CStrArgument ;
6
- use foreign_types:: { foreign_type, ForeignType } ;
6
+ use foreign_types:: { foreign_type, ForeignType , ForeignTypeRef } ;
7
7
use libc:: { c_char, c_int, size_t} ;
8
8
use log:: { self , Level , Log , Record , SetLoggerError } ;
9
9
use memchr:: memchr;
@@ -242,7 +242,7 @@ pub struct DisplayEntryData<'a> {
242
242
// iteration/next/previous)
243
243
// - we have _total_ ownership over data iteration. Do what ever necessary to get all the data
244
244
// we want
245
- journal : RefCell < & ' a mut Journal > ,
245
+ journal : RefCell < & ' a mut JournalRef > ,
246
246
}
247
247
248
248
impl < ' a > fmt:: Display for DisplayEntryData < ' a > {
@@ -268,8 +268,8 @@ impl<'a> fmt::Display for DisplayEntryData<'a> {
268
268
}
269
269
}
270
270
271
- impl < ' a > From < & ' a mut Journal > for DisplayEntryData < ' a > {
272
- fn from ( v : & ' a mut Journal ) -> Self {
271
+ impl < ' a > From < & ' a mut JournalRef > for DisplayEntryData < ' a > {
272
+ fn from ( v : & ' a mut JournalRef ) -> Self {
273
273
Self {
274
274
journal : RefCell :: new ( v) ,
275
275
}
@@ -381,7 +381,9 @@ impl Journal {
381
381
sd_try ! ( ffi:: sd_journal_open_files( & mut jp, c_paths_ptr. as_ptr( ) , 0 ) ) ;
382
382
Ok ( unsafe { Journal :: from_ptr ( jp) } )
383
383
}
384
+ }
384
385
386
+ impl JournalRef {
385
387
/// Fields that are longer that this number of bytes _may_ be truncated when retrieved by this [`Journal`]
386
388
/// instance.
387
389
///
@@ -728,7 +730,7 @@ impl Journal {
728
730
729
731
/// Adds a match by which to filter the entries of the journal.
730
732
/// If a match is applied, only entries with this field set will be iterated.
731
- pub fn match_add < T : Into < Vec < u8 > > > ( & mut self , key : & str , val : T ) -> Result < & mut Journal > {
733
+ pub fn match_add < T : Into < Vec < u8 > > > ( & mut self , key : & str , val : T ) -> Result < & mut JournalRef > {
732
734
let mut filter = Vec :: < u8 > :: from ( key) ;
733
735
filter. push ( b'=' ) ;
734
736
filter. extend ( val. into ( ) ) ;
@@ -739,21 +741,21 @@ impl Journal {
739
741
}
740
742
741
743
/// Inserts a disjunction (i.e. logical OR) in the match list.
742
- pub fn match_or ( & mut self ) -> Result < & mut Journal > {
744
+ pub fn match_or ( & mut self ) -> Result < & mut JournalRef > {
743
745
sd_try ! ( ffi:: sd_journal_add_disjunction( self . as_ptr( ) ) ) ;
744
746
Ok ( self )
745
747
}
746
748
747
749
/// Inserts a conjunction (i.e. logical AND) in the match list.
748
- pub fn match_and ( & mut self ) -> Result < & mut Journal > {
750
+ pub fn match_and ( & mut self ) -> Result < & mut JournalRef > {
749
751
sd_try ! ( ffi:: sd_journal_add_conjunction( self . as_ptr( ) ) ) ;
750
752
Ok ( self )
751
753
}
752
754
753
755
/// Flushes all matches, disjunction and conjunction terms.
754
756
/// After this call all filtering is removed and all entries in
755
757
/// the journal will be iterated again.
756
- pub fn match_flush ( & mut self ) -> Result < & mut Journal > {
758
+ pub fn match_flush ( & mut self ) -> Result < & mut JournalRef > {
757
759
unsafe { ffi:: sd_journal_flush_matches ( self . as_ptr ( ) ) } ;
758
760
Ok ( self )
759
761
}
0 commit comments