summaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-14 13:30:59 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-14 13:30:59 -0700
commit1337f7ae5c27983c732dd86bf1f11c04918eee62 (patch)
tree98034885b2f5f110548c77a725b9b84d6245eece /rust/src
parent3aeea90aabe6384f84aba835e93b8f7e0d68e009 (diff)
downloadfatcat-1337f7ae5c27983c732dd86bf1f11c04918eee62.tar.gz
fatcat-1337f7ae5c27983c732dd86bf1f11c04918eee62.zip
rust codegen and impl
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/entity_crud.rs40
-rw-r--r--rust/src/identifiers.rs3
2 files changed, 21 insertions, 22 deletions
diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs
index 3bd19cce..8f4c33a8 100644
--- a/rust/src/entity_crud.rs
+++ b/rust/src/entity_crud.rs
@@ -1048,11 +1048,11 @@ impl EntityCrud for FileEntity {
None => (None, None, None),
};
- let urls: Vec<FileEntityUrls> = file_rev_url::table
+ let urls: Vec<FileUrl> = file_rev_url::table
.filter(file_rev_url::file_rev.eq(rev_row.id))
.get_results(conn)?
.into_iter()
- .map(|r: FileRevUrlRow| FileEntityUrls {
+ .map(|r: FileRevUrlRow| FileUrl {
rel: r.rel,
url: r.url,
})
@@ -1221,11 +1221,11 @@ impl EntityCrud for FilesetEntity {
None => (None, None, None),
};
- let manifest: Vec<FilesetEntityManifest> = fileset_rev_file::table
+ let manifest: Vec<FilesetFile> = fileset_rev_file::table
.filter(fileset_rev_file::fileset_rev.eq(rev_row.id))
.get_results(conn)?
.into_iter()
- .map(|r: FilesetRevFileRow| FilesetEntityManifest {
+ .map(|r: FilesetRevFileRow| FilesetFile {
path: r.path_name,
size: r.size_bytes,
md5: r.md5,
@@ -1235,11 +1235,11 @@ impl EntityCrud for FilesetEntity {
})
.collect();
- let urls: Vec<FileEntityUrls> = fileset_rev_url::table
+ let urls: Vec<FilesetUrl> = fileset_rev_url::table
.filter(fileset_rev_url::fileset_rev.eq(rev_row.id))
.get_results(conn)?
.into_iter()
- .map(|r: FilesetRevUrlRow| FileEntityUrls {
+ .map(|r: FilesetRevUrlRow| FilesetUrl {
rel: r.rel,
url: r.url,
})
@@ -1431,11 +1431,11 @@ impl EntityCrud for WebcaptureEntity {
None => (None, None, None),
};
- let cdx: Vec<WebcaptureEntityCdx> = webcapture_rev_cdx::table
+ let cdx: Vec<WebcaptureCdxLine> = webcapture_rev_cdx::table
.filter(webcapture_rev_cdx::webcapture_rev.eq(rev_row.id))
.get_results(conn)?
.into_iter()
- .map(|c: WebcaptureRevCdxRow| WebcaptureEntityCdx {
+ .map(|c: WebcaptureRevCdxRow| WebcaptureCdxLine {
surt: c.surt,
timestamp: c.timestamp,
url: c.url,
@@ -1447,11 +1447,11 @@ impl EntityCrud for WebcaptureEntity {
})
.collect();
- let archive_urls: Vec<WebcaptureEntityArchiveUrls> = webcapture_rev_url::table
+ let archive_urls: Vec<WebcaptureUrl> = webcapture_rev_url::table
.filter(webcapture_rev_url::webcapture_rev.eq(rev_row.id))
.get_results(conn)?
.into_iter()
- .map(|r: WebcaptureRevUrlRow| WebcaptureEntityArchiveUrls {
+ .map(|r: WebcaptureRevUrlRow| WebcaptureUrl {
rel: r.rel,
url: r.url,
})
@@ -1641,7 +1641,7 @@ impl EntityCrud for ReleaseEntity {
language: None,
license_slug: None,
work_id: None,
- ext_ids: ReleaseEntityExtIds {
+ ext_ids: ReleaseExtIds {
doi: None,
pmid: None,
pmcid: None,
@@ -1897,7 +1897,7 @@ impl EntityCrud for ReleaseEntity {
),
};
- let abstracts: Option<Vec<ReleaseEntityAbstracts>> = if hide.abstracts {
+ let abstracts: Option<Vec<ReleaseAbstract>> = if hide.abstracts {
None
} else {
Some(
@@ -1906,19 +1906,17 @@ impl EntityCrud for ReleaseEntity {
.filter(release_rev_abstract::release_rev.eq(rev_row.id))
.get_results(conn)?
.into_iter()
- .map(
- |r: (ReleaseRevAbstractRow, AbstractsRow)| ReleaseEntityAbstracts {
- sha1: Some(r.0.abstract_sha1),
- mimetype: r.0.mimetype,
- lang: r.0.lang,
- content: Some(r.1.content),
- },
- )
+ .map(|r: (ReleaseRevAbstractRow, AbstractsRow)| ReleaseAbstract {
+ sha1: Some(r.0.abstract_sha1),
+ mimetype: r.0.mimetype,
+ lang: r.0.lang,
+ content: Some(r.1.content),
+ })
.collect(),
)
};
- let mut ext_ids = ReleaseEntityExtIds {
+ let mut ext_ids = ReleaseExtIds {
doi: rev_row.doi,
pmid: rev_row.pmid,
pmcid: rev_row.pmcid,
diff --git a/rust/src/identifiers.rs b/rust/src/identifiers.rs
index ae75c8a7..88e22960 100644
--- a/rust/src/identifiers.rs
+++ b/rust/src/identifiers.rs
@@ -275,7 +275,8 @@ fn test_check_doi() {
pub fn check_arxiv_id(raw: &str) -> Result<()> {
lazy_static! {
- static ref RE: Regex = Regex::new(r"^(\d{4}.\d{4,5}|[a-z\-]+(\.[A-Z]{2})?/\d{7})v\d+$").unwrap();
+ static ref RE: Regex =
+ Regex::new(r"^(\d{4}.\d{4,5}|[a-z\-]+(\.[A-Z]{2})?/\d{7})v\d+$").unwrap();
}
if raw.is_ascii() && RE.is_match(raw) {
Ok(())