[][src]Struct file_sql::app::App

pub struct App {
    pub path: Option<String>,
    pub data: Vec<AppData>,
    pub keys: Vec<String>,
    // some fields omitted
}

主控制器

Examples

use file_sql::*;
let app = App::from_file("example.fql");

Fields

path: Option<String>

文件路径

data: Vec<AppData>

储存数据

keys: Vec<String>

键名列表

Implementations

impl App[src]

pub fn from_file<T: Display>(path: T) -> Result<Self>[src]

加载 fql 文件

pub fn serialize(&self) -> Vec<HashMap<String, Value>>[src]

直接生成可序列化数据

pub fn merge_data(&mut self, data: Vec<AppData>)[src]

pub fn save_at<T: Display>(&self, path: T)[src]

保存文件到指定位置

pub fn create_data(&self) -> AppData[src]

创建空的数据

pub fn init_data(&self, data: &mut AppData)[src]

将指定数据初始化

pub fn save(&self)[src]

保存文件

Trait Implementations

impl Clone for App[src]

impl Debug for App[src]

impl Editor for App[src]

pub fn replace(&mut self, index: usize, new_data: AppData)[src]

修改一行数据 #Example

 use file_sql::*;
 let app = App::from_file("example.fql");
 let new_data = app.find_index(1);
 app.replace(0, "age", new_data.to_owned());

pub fn insert(&mut self, index: usize, new_data: AppData)[src]

在指定一行加入数据

pub fn remove(&mut self, index: usize)[src]

删除某一列数据 #Example

 use file_sql::*;
 let app = App::from_file("example.fql");
 app.remove(1); // 删除第二行数据

pub fn add(&mut self, new_data: AppData)[src]

添加数据到末尾

impl From<&'_ str> for App[src]

impl From<Vec<&'_ AppData, Global>> for App[src]

impl From<Vec<AppData, Global>> for App[src]

impl From<Vec<String, Global>> for App[src]

impl Into<Vec<Vec<FQLType, Global>, Global>> for App[src]

impl Reader for App[src]

pub fn index(&self, index: usize) -> Option<&AppData>[src]

查找指定序号的数据

pub fn find<T: Display>(&self, key: T, val: FQLType) -> Option<&AppData>[src]

查找第一个符合条件的数据

pub fn find_index<T: Display>(&self, key: T, val: FQLType) -> Option<usize>[src]

查找第一个符合条件的数据的序号

pub fn find_all<T: Display>(&self, key: T, val: FQLType) -> Vec<&AppData>[src]

获取所有符合条件的数据

pub fn find_all_index<T: Display>(&self, key: T, val: FQLType) -> Vec<usize>[src]

获取所有符合条件的数据序号

pub fn find_by<T: Display>(
    &self,
    key: T,
    f: impl Fn(&FQLType) -> bool
) -> Vec<&AppData>
[src]

获取所有符合过滤函数的数据

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.