mirror of
https://github.com/GayPizzaSpecifications/stable-diffusion-rpc.git
synced 2025-08-03 05:30:54 +00:00
145 lines
5.2 KiB
Swift
145 lines
5.2 KiB
Swift
// DO NOT EDIT.
|
|
// swift-format-ignore-file
|
|
// swiftlint:disable all
|
|
//
|
|
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
|
// Source: tokenizer.proto
|
|
//
|
|
// For information on using the generated types, please see the documentation:
|
|
// https://github.com/apple/swift-protobuf/
|
|
|
|
///*
|
|
/// Tokenization for the Stable Diffusion RPC service.
|
|
|
|
import SwiftProtobuf
|
|
|
|
// If the compiler emits an error on this type, it is because this file
|
|
// was generated by a version of the `protoc` Swift plug-in that is
|
|
// incompatible with the version of SwiftProtobuf to which you are linking.
|
|
// Please ensure that you are building against the same version of the API
|
|
// that was used to generate this file.
|
|
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
|
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
|
typealias Version = _2
|
|
}
|
|
|
|
///*
|
|
/// Represents a request to tokenize an input.
|
|
public struct SdTokenizeRequest: Sendable {
|
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
|
// methods supported on all messages.
|
|
|
|
///*
|
|
/// The name of a loaded model to use for tokenization.
|
|
public var modelName: String = String()
|
|
|
|
///*
|
|
/// The input string to tokenize.
|
|
public var input: String = String()
|
|
|
|
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
|
|
|
public init() {}
|
|
}
|
|
|
|
///*
|
|
/// Represents a response to tokenization.
|
|
public struct SdTokenizeResponse: Sendable {
|
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
|
// methods supported on all messages.
|
|
|
|
///*
|
|
/// The tokens inside the input string.
|
|
public var tokens: [String] = []
|
|
|
|
///*
|
|
/// The token IDs inside the input string.
|
|
public var tokenIds: [UInt64] = []
|
|
|
|
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
|
|
|
public init() {}
|
|
}
|
|
|
|
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
|
|
|
fileprivate let _protobuf_package = "gay.pizza.stable.diffusion"
|
|
|
|
extension SdTokenizeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
|
public static let protoMessageName: String = _protobuf_package + ".TokenizeRequest"
|
|
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
|
1: .standard(proto: "model_name"),
|
|
2: .same(proto: "input"),
|
|
]
|
|
|
|
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
|
// The use of inline closures is to circumvent an issue where the compiler
|
|
// allocates stack space for every case branch when no optimizations are
|
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
|
switch fieldNumber {
|
|
case 1: try { try decoder.decodeSingularStringField(value: &self.modelName) }()
|
|
case 2: try { try decoder.decodeSingularStringField(value: &self.input) }()
|
|
default: break
|
|
}
|
|
}
|
|
}
|
|
|
|
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
|
if !self.modelName.isEmpty {
|
|
try visitor.visitSingularStringField(value: self.modelName, fieldNumber: 1)
|
|
}
|
|
if !self.input.isEmpty {
|
|
try visitor.visitSingularStringField(value: self.input, fieldNumber: 2)
|
|
}
|
|
try unknownFields.traverse(visitor: &visitor)
|
|
}
|
|
|
|
public static func ==(lhs: SdTokenizeRequest, rhs: SdTokenizeRequest) -> Bool {
|
|
if lhs.modelName != rhs.modelName {return false}
|
|
if lhs.input != rhs.input {return false}
|
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
|
return true
|
|
}
|
|
}
|
|
|
|
extension SdTokenizeResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
|
public static let protoMessageName: String = _protobuf_package + ".TokenizeResponse"
|
|
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
|
1: .same(proto: "tokens"),
|
|
2: .standard(proto: "token_ids"),
|
|
]
|
|
|
|
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
|
// The use of inline closures is to circumvent an issue where the compiler
|
|
// allocates stack space for every case branch when no optimizations are
|
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
|
switch fieldNumber {
|
|
case 1: try { try decoder.decodeRepeatedStringField(value: &self.tokens) }()
|
|
case 2: try { try decoder.decodeRepeatedUInt64Field(value: &self.tokenIds) }()
|
|
default: break
|
|
}
|
|
}
|
|
}
|
|
|
|
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
|
if !self.tokens.isEmpty {
|
|
try visitor.visitRepeatedStringField(value: self.tokens, fieldNumber: 1)
|
|
}
|
|
if !self.tokenIds.isEmpty {
|
|
try visitor.visitPackedUInt64Field(value: self.tokenIds, fieldNumber: 2)
|
|
}
|
|
try unknownFields.traverse(visitor: &visitor)
|
|
}
|
|
|
|
public static func ==(lhs: SdTokenizeResponse, rhs: SdTokenizeResponse) -> Bool {
|
|
if lhs.tokens != rhs.tokens {return false}
|
|
if lhs.tokenIds != rhs.tokenIds {return false}
|
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
|
return true
|
|
}
|
|
}
|