base/version
판. (major.minor.patch, 브랜치가 있으면 major.minor.patch-branch, 원본 base/version.js)
- 필드를 그대로 열고, 원본의 get_major / set_major 같은 접근자와 getVersionString 도 같은 이름으로 둔다.
- 브랜치가 글이라 Copy 가 아니다. create 는 원본 기본 인자처럼 브랜치 없이, create_with_branch 는 브랜치를 받는다.
Version. (major.minor.patch, major.minor.patch-branch if there is a branch, the original base/version.js)
- The fields are left open, and the original's accessors like get_major / set_major and getVersionString are kept under the same names.
- The branch is a string, so it is not Copy. create has no branch like the original default arguments, and create_with_branch takes a branch.
Versionstruct traits Clone, Debug, PartialEq, Eq
판. (주, 부, 패치 번호와 브랜치 이름)
Version. (major, minor and patch numbers and branch name)
use vanilla::Version;
let mut version = Version::create(0, 4, 0);
assert_eq!(version.to_string(), "0.4.0");
version.set_branch("experimental");
assert_eq!(version.get_version_string(), "0.4.0-experimental");
version.patch += 1;
assert_eq!(version, Version::create_with_branch(0, 4, 1, "experimental"));생성. (브랜치 없음)
Constructor. (no branch)
- majoru32
- 주 판 번호.Major version number.
- minoru32
- 부 판 번호.Minor version number.
- patchu32
- 패치 판 번호.Patch version number.
반환ReturnsVersion 브랜치 없는 판. (const fn 이라 상수로 둘 수 있다)A version with no branch. (a const fn, so it can be kept as a constant)
짝Counterpart: vanilla.js Version.create
use vanilla::Version;
const GAME_VERSION: Version = Version::create(1, 2, 3);
assert_eq!(GAME_VERSION.to_string(), "1.2.3");브랜치를 붙여 생성. (빈 글이면 브랜치 없음)
Creates with a branch. (no branch if empty)
- majoru32
- 주 판 번호.Major version number.
- minoru32
- 부 판 번호.Minor version number.
- patchu32
- 패치 판 번호.Patch version number.
- branch&str
- 브랜치 이름. (빈 글이면 브랜치 없음)Branch name. (no branch if empty)
반환ReturnsVersion 그 브랜치를 붙인 판.A version with that branch attached.
주 판 설정과 반환.
Sets and returns the major version.
- majoru32
- 새 주 판 번호.New major version number.
짝Counterpart: vanilla.js Version.setMajor
주 판 반환.
Returns the major version.
반환Returnsu32 주 판 번호.Major version number.
짝Counterpart: vanilla.js Version.getMajor
부 판 설정과 반환.
Sets and returns the minor version.
- minoru32
- 새 부 판 번호.New minor version number.
짝Counterpart: vanilla.js Version.setMinor
부 판 반환.
Returns the minor version.
반환Returnsu32 부 판 번호.Minor version number.
짝Counterpart: vanilla.js Version.getMinor
패치 판 설정과 반환.
Sets and returns the patch version.
- patchu32
- 새 패치 판 번호.New patch version number.
짝Counterpart: vanilla.js Version.setPatch
패치 판 반환.
Returns the patch version.
반환Returnsu32 패치 판 번호.Patch version number.
짝Counterpart: vanilla.js Version.getPatch
브랜치 설정과 반환. (빈 글이면 브랜치 없음)
Sets and returns the branch. (no branch if empty)
- branch&str
- 새 브랜치 이름. (빈 글이면 브랜치 없음)New branch name. (no branch if empty)
짝Counterpart: vanilla.js Version.setBranch
브랜치 반환.
Returns the branch.
반환Returns&str 브랜치 이름. (없으면 빈 글)Branch name. (empty string if none)
짝Counterpart: vanilla.js Version.getBranch
판 문자열. (원본 getVersionString, to_string 과 같다)
Version string. (the original getVersionString, same as to_string)
반환ReturnsString to_string 과 같은 판 글.Version string, same as to_string.
짝Counterpart: vanilla.js Version.getVersionString
"major.minor.patch" 문자열. (브랜치가 있으면 "major.minor.patch-branch")
"major.minor.patch" string. ("major.minor.patch-branch" if there is a branch)
반환ReturnsString 판 글. ("0.3.2", 브랜치가 있으면 "0.4.0-experimental" 처럼 하이픈 뒤에 붙인다)Version string. ("0.3.2"; a branch is appended after a hyphen, like "0.4.0-experimental")