use super::*;
pub trait KernelWithReflection: MessageDescriptorInterop {}
impl<T: MessageDescriptorInterop> KernelWithReflection for T {}
#[cfg(not(lite_runtime))]
unsafe extern "C" {
fn proto2_rust_Message_print_to_text_format(
m: RawMessage,
single_line: bool,
hide_unknown_fields: bool,
) -> RustStringRawParts;
fn proto2_rust_Message_parse_from_text_format(m: RawMessage, input: PtrAndLen) -> bool;
}
#[cfg(not(lite_runtime))]
pub fn print_to_text_format<T: crate::WithReflection>(
msg: &T,
single_line: bool,
hide_unknown_fields: bool,
) -> String {
let raw = msg.as_view().get_raw_message(Private);
unsafe { proto2_rust_Message_print_to_text_format(raw, single_line, hide_unknown_fields) }
.into()
}
#[cfg(not(lite_runtime))]
pub fn parse_from_text_format<T: crate::WithReflection>(input: &str) -> Result<T, ParseError> {
let mut msg = T::default();
let raw = msg.get_raw_message_mut(Private);
unsafe { proto2_rust_Message_parse_from_text_format(raw, input.as_bytes().into()) }
.then_some(msg)
.ok_or(ParseError)
}