pub fn to_worker_sdk(&self) -> (Worker_LogsinkParameters, Vec<ReleaseCallbackHandle>) {
        let rotating_logfile_parameters = match self.logsink_type {
            LogsinkType::RotatingFile(ref params) => params.to_worker_sdk(),
            _ => Worker_RotatingLogFileParameters {
                log_prefix: WORKER_DEFAULTS_LOG_PREFIX.as_ptr() as *const i8,
                max_log_files: 0,
                max_log_file_size_bytes: 0,
            },
        };

        let (log_callback_parameters, release_log_callback_handle) = match self.logsink_type {
            LogsinkType::Callback(callback) => {
                let callback_ptr = Box::into_raw(Box::new(callback)) as *mut ::std::os::raw::c_void;

                (
                    Worker_LogCallbackParameters {
                        log_callback: Some(worker_log_callback),
                        user_data: callback_ptr,
                    },
                    Some(Box::new(move || unsafe {
                        Box::from_raw(callback_ptr as *mut LogCallback);
                    }) as ReleaseCallbackHandle),
                )
            }
            _ => Default::default(),
        };

        let (filter_parameters, release_filter_callback_handle) =
            self.filter_parameters.to_worker_sdk();

        let release_handle_funcs = release_log_callback_handle
            .into_iter()
            .chain(release_filter_callback_handle.into_iter())
            .collect();

        (
            Worker_LogsinkParameters {
                logsink_type: self.logsink_type.worker_sdk_type() as u8,
                filter_parameters,
                rotating_logfile_parameters,
                log_callback_parameters,
            },
            release_handle_funcs,
        )
    }
/// Converts the rotating log parameters into the equivalent C API type.
///
/// # Safety
///
/// The returned `Worker_LogsinkParameters` borrows data owned by `self`,
/// and therefore must not outlive `self`.
Converts the rotating log parameters into the equivalent C API type.
Converts the rotating log parameters into the equivalent C API type .
pub fn to_worker_sdk(&self) -> (Worker_LogsinkParameters, Vec<ReleaseCallbackHandle>) {
        let rotating_logfile_parameters = match self.logsink_type {
            LogsinkType::RotatingFile(ref params) => params.to_worker_sdk(),
            _ => Worker_RotatingLogFileParameters {
                log_prefix: WORKER_DEFAULTS_LOG_PREFIX.as_ptr() as *const i8,
                max_log_files: 0,
                max_log_file_size_bytes: 0,
            },
        };
        let (log_callback_parameters, release_log_callback_handle) = match self.logsink_type {
            LogsinkType::Callback(callback) => {
                let callback_ptr = Box::into_raw(Box::new(callback)) as *mut ::std::os::raw::c_void;
                (
                    Worker_LogCallbackParameters {
                        log_callback: Some(worker_log_callback),
                        user_data: callback_ptr,
                    },
                    Some(Box::new(move || unsafe {
                        Box::from_raw(callback_ptr as *mut LogCallback);
                    }) as ReleaseCallbackHandle),
                )
            }
            _ => Default::default(),
        };
        let (filter_parameters, release_filter_callback_handle) =
            self.filter_parameters.to_worker_sdk();
        let release_handle_funcs = release_log_callback_handle
            .into_iter()
            .chain(release_filter_callback_handle.into_iter())
            .collect();
        (
            Worker_LogsinkParameters {
                logsink_type: self.logsink_type.worker_sdk_type() as u8,
                filter_parameters,
                rotating_logfile_parameters,
                log_callback_parameters,
            },
            release_handle_funcs,
        )
    }
pub fn to_worker_sdk ( & self ) -> ( Worker_LogsinkParameters , Vec < ReleaseCallbackHandle > ) { let rotating_logfile_parameters = match self . logsink_type { LogsinkType :: RotatingFile ( ref params ) => params . to_worker_sdk ( ) , _ => Worker_RotatingLogFileParameters { log_prefix : WORKER_DEFAULTS_LOG_PREFIX . as_ptr ( ) as * const i8 , max_log_files : 0 , max_log_file_size_bytes : 0 , } , } ; let ( log_callback_parameters , release_log_callback_handle ) = match self . logsink_type { LogsinkType :: Callback ( callback ) => { let callback_ptr = Box :: into_raw ( Box :: new ( callback ) ) as * mut :: std :: os :: raw :: c_void ; ( Worker_LogCallbackParameters { log_callback : Some ( worker_log_callback ) , user_data : callback_ptr , } , Some ( Box :: new ( move | | unsafe { Box :: from_raw ( callback_ptr as * mut LogCallback ) ; } ) as ReleaseCallbackHandle ) , ) } _ => Default :: default ( ) , } ; let ( filter_parameters , release_filter_callback_handle ) = self . filter_parameters . to_worker_sdk ( ) ; let release_handle_funcs = release_log_callback_handle . into_iter ( ) . chain ( release_filter_callback_handle . into_iter ( ) ) . collect ( ) ; ( Worker_LogsinkParameters { logsink_type : self . logsink_type . worker_sdk_type ( ) as u8 , filter_parameters , rotating_logfile_parameters , log_callback_parameters , } , release_handle_funcs , ) }
Converts the rotating log parameters into the equivalent C API type.
Converts the rotating log parameters into the equivalent C API type .
&self
&self
safety
The returned `Worker_LogsinkParameters` borrows data owned by `self`,
and therefore must not outlive `self`.
The returned ` Worker_LogsinkParameters ` borrows data owned by ` self ` and therefore must not outlive ` self ` .