Skip to main content

Php

Struct Php 

Source
pub struct Php;
Expand description

The PHP array resource filter.

Implementations§

Source§

impl Php

Source

pub fn extract_with( &self, bytes: &[u8], opts: &ExtractOptions, limits: &Limits, ) -> Result<Document, Error>

extract with explicit size limits.

Trait Implementations§

Source§

impl Filter for Php

Source§

fn sniff(&self, bytes: &[u8]) -> bool

True when the whole file is a static PHP language file: it starts with <?php, parses, and holds at least one return or assignment statement. Tight enough to be put anywhere in the filter list.

Source§

fn id(&self) -> &'static str

Short id, e.g. “html”.
Source§

fn extensions(&self) -> &'static [&'static str]

Lowercase extensions without the dot, e.g. ["html", "htm"].
Source§

fn extract( &self, bytes: &[u8], opts: &ExtractOptions, ) -> Result<Document, Error>

Source file to document. One segment per unit; no sentence splitting here.
Source§

fn merge_with( &self, doc: &Document, opts: &MergeOptions, ) -> Result<Vec<u8>, Error>

Document back to a file in the original format, targets in place of sources, with MergeOptions. Every format honours both options: output_encoding (keep the file’s encoding, or write UTF-8) and stamp_target_always (stamp the target language and fill plurals even when nothing is translated; the rule is MergeOptions::should_stamp).
Source§

fn bilingual(&self) -> bool

True when the format carries source and target (PO, XLIFF and the like): its extract may fill segment targets and states. False for source files.
Source§

fn format_option_keys(&self) -> &'static [FormatOptionKey]

The ExtractOptions::format_options keys this filter reads ("csv.columns", …), each with the <family>. prefix of its format. The facade refuses keys no filter declares; the filter itself refuses undeclared keys of its own families (check_own_options). Default: none.
Source§

fn merge(&self, doc: &Document) -> Result<Vec<u8>, Error>

Filter::merge_with with the default options: the file’s own encoding, and no stamp when nothing is translated (an untouched merge gives the original bytes).
Source§

fn preview(&self, _doc: &Document) -> Option<String>

For formats a browser can show: the translated document as HTML in which every segment’s text sits in <span data-bl-seg="SEGMENT_ID">..</span>, so a live preview can patch one segment without reloading. Scripts must be stripped. None when the format has no preview.
Source§

fn render_segment(&self, _doc: &Document, _seg_id: &str) -> Option<String>

The inner HTML of one segment’s span in preview() (its current target, or source when empty), so a live preview can patch that span in place. None when the format has no preview or the id is unknown.

Auto Trait Implementations§

§

impl Forget for Php

§

impl Freeze for Php

§

impl RefUnwindSafe for Php

§

impl Send for Php

§

impl Sync for Php

§

impl Unpin for Php

§

impl UnsafeUnpin for Php

§

impl UnwindSafe for Php

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.