pub struct GitHubFormat {
pub repo_id: String,
pub owner: String,
pub repo: String,
pub headers: HashMap<String, String>,
pub agent: Agent,
}
Expand description
Stof GitHub Format.
Fields§
§repo_id: String
Format Repo ID. Ex. “formata” means format is “github:formata”.
owner: String
Repository owner.
repo: String
Repository name.
headers: HashMap<String, String>
Headers.
agent: Agent
Agent.
Implementations§
Source§impl GitHubFormat
impl GitHubFormat
Trait Implementations§
Source§impl Format for GitHubFormat
impl Format for GitHubFormat
Source§fn format(&self) -> String
fn format(&self) -> String
How this format will be accessed in Stof. For example, if repo_id is “formata”, using this library would be the format identifier “github:formata”.
import github:formata "myfile.stof" as Import;
Source§fn file_import(
&self,
pid: &str,
doc: &mut SDoc,
format: &str,
full_path: &str,
extension: &str,
as_name: &str,
) -> Result<(), SError>
fn file_import( &self, pid: &str, doc: &mut SDoc, format: &str, full_path: &str, extension: &str, as_name: &str, ) -> Result<(), SError>
The GitHub format only allows a file import. Gets the contents of the file at a path in this GitHub repo, then imports it as a string using the file extension. Will error if a Format with the requested file extension is not available in the doc.
Source§fn content_type(&self) -> String
fn content_type(&self) -> String
Content type.
Used when sending documents over the wire, etc…
Source§fn header_import(
&self,
pid: &str,
doc: &mut SDoc,
content_type: &str,
bytes: &mut Bytes,
as_name: &str,
) -> Result<(), SError>
fn header_import( &self, pid: &str, doc: &mut SDoc, content_type: &str, bytes: &mut Bytes, as_name: &str, ) -> Result<(), SError>
Content type import.
Source§fn string_import(
&self,
pid: &str,
doc: &mut SDoc,
src: &str,
as_name: &str,
) -> Result<(), SError>
fn string_import( &self, pid: &str, doc: &mut SDoc, src: &str, as_name: &str, ) -> Result<(), SError>
String import.
Source§fn export_string(
&self,
pid: &str,
doc: &SDoc,
node: Option<&SNodeRef>,
) -> Result<String, SError>
fn export_string( &self, pid: &str, doc: &SDoc, node: Option<&SNodeRef>, ) -> Result<String, SError>
Export document into a string (human readable string).
Auto Trait Implementations§
impl Freeze for GitHubFormat
impl !RefUnwindSafe for GitHubFormat
impl Send for GitHubFormat
impl Sync for GitHubFormat
impl Unpin for GitHubFormat
impl !UnwindSafe for GitHubFormat
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