#[repr(C)]pub struct SpanOutput {
pub text: *const u8,
pub text_len: u32,
pub spans: *const Span,
pub span_count: u32,
pub extra_data: *const u8,
pub extra_data_len: u32,
pub utf16_offsets: *const u32,
pub utf16_offsets_len: u32,
}Expand description
Span 输出(包含文本、span 数组和额外数据) 注意:不实现 Clone / Copy,防止双份指针导致 double-free
Fields§
§text: *const u8全文纯文本(所有 span 的 offset/len 索引此 buffer 的子串)
text_len: u32§spans: *const SpanSpan 数组
span_count: u32§extra_data: *const u8额外数据区(链接 URL、图片 URL 等)
extra_data_len: u32§utf16_offsets: *const u32可选:与 spans 一一对应的 UTF-16 偏移(指针为 null 表示未启用) 用于 iOS(NSString)/Android(SpannableString) 等 UTF-16 平台的零拷贝偏移转换
utf16_offsets_len: u32Implementations§
Source§impl SpanOutput
impl SpanOutput
Sourcepub unsafe fn from_buffers(text: &[u8], spans: &[Span], extra: &[u8]) -> Self
pub unsafe fn from_buffers(text: &[u8], spans: &[Span], extra: &[u8]) -> Self
从拥有的数据创建 SpanOutput(用于测试和内部使用) 调用者必须保持这些 buffer 存活
Trait Implementations§
Auto Trait Implementations§
impl !Send for SpanOutput
impl !Sync for SpanOutput
impl Freeze for SpanOutput
impl RefUnwindSafe for SpanOutput
impl Unpin for SpanOutput
impl UnsafeUnpin for SpanOutput
impl UnwindSafe for SpanOutput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more