// Generated by alef. Do not edit by hand. // swift-format-ignore-file import Foundation import RustBridge public struct CacheStats: Codable, Sendable, Hashable { public let totalFiles: UInt public let totalSizeMb: Double public let availableSpaceMb: Double public let oldestFileAgeDays: Double public let newestFileAgeDays: Double public init(totalFiles: UInt, totalSizeMb: Double, availableSpaceMb: Double, oldestFileAgeDays: Double, newestFileAgeDays: Double) { self.totalFiles = totalFiles self.totalSizeMb = totalSizeMb self.availableSpaceMb = availableSpaceMb self.oldestFileAgeDays = oldestFileAgeDays self.newestFileAgeDays = newestFileAgeDays } private enum CodingKeys: String, CodingKey { case totalFiles = "total_files" case totalSizeMb = "total_size_mb" case availableSpaceMb = "available_space_mb" case oldestFileAgeDays = "oldest_file_age_days" case newestFileAgeDays = "newest_file_age_days" } } // MARK: - Internal FFI conversions for CacheStats internal extension CacheStats { init(_ rb: RustBridge.CacheStatsRef) throws { self.totalFiles = rb.totalFiles() self.totalSizeMb = rb.totalSizeMb() self.availableSpaceMb = rb.availableSpaceMb() self.oldestFileAgeDays = rb.oldestFileAgeDays() self.newestFileAgeDays = rb.newestFileAgeDays() } func intoRust() throws -> RustBridge.CacheStats { return RustBridge.CacheStats(self.totalFiles, self.totalSizeMb, self.availableSpaceMb, self.oldestFileAgeDays, self.newestFileAgeDays) } } /// Hardware acceleration configuration for ONNX Runtime models. /// /// Controls which execution provider (CPU, CoreML, CUDA, TensorRT) is used /// for inference in layout detection and embedding generation. /// /// # Example /// /// ```rust /// use kreuzberg::AccelerationConfig; /// /// // Auto-select: CoreML on macOS, CUDA on Linux, CPU elsewhere /// let config = AccelerationConfig::default(); /// /// // Force CPU only /// let config = AccelerationConfig { /// provider: kreuzberg::ExecutionProviderType::Cpu, /// ..Default::default() /// }; /// ``` public struct AccelerationConfig: Codable, Sendable, Hashable { /// Execution provider to use for ONNX inference. public let provider: ExecutionProviderType /// GPU device ID (for CUDA/TensorRT). Ignored for CPU/CoreML/Auto. public let deviceId: UInt32 public init(provider: ExecutionProviderType, deviceId: UInt32) { self.provider = provider self.deviceId = deviceId } private enum CodingKeys: String, CodingKey { case provider = "provider" case deviceId = "device_id" } public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.provider = try container.decode(ExecutionProviderType.self, forKey: .provider) self.deviceId = try container.decodeIfPresent(UInt32.self, forKey: .deviceId) ?? 0 } } // MARK: - Internal FFI conversions for AccelerationConfig internal extension AccelerationConfig { init(_ rb: RustBridge.AccelerationConfigRef) throws { self.provider = ExecutionProviderType(rawValue: rb.provider().toString()) ?? { fatalError("Unknown ExecutionProviderType: \(rb.provider().toString())") }() self.deviceId = rb.deviceId() } func intoRust() throws -> RustBridge.AccelerationConfig { return RustBridge.AccelerationConfig(try self.provider.intoRust(), self.deviceId) } } /// Cross-extractor content filtering configuration. /// /// Controls whether "furniture" content (headers, footers, page numbers, /// watermarks, repeating text) is included in or stripped from extraction /// results. Applies across all extractors (PDF, DOCX, RTF, ODT, HTML, etc.) /// with format-specific implementation. /// /// When `None` on `ExtractionConfig`, each extractor uses its current /// default behavior unchanged. public struct ContentFilterConfig: Codable, Sendable, Hashable { /// Include running headers in extraction output. /// /// - PDF: Disables top-margin furniture stripping and prevents the layout /// model from treating `PageHeader`-classified regions as furniture. /// - DOCX: Includes document headers in text output. /// - RTF/ODT: Headers already included; this is a no-op when true. /// - HTML/EPUB: Keeps `
` element content. /// /// Default: `false` (headers are stripped or excluded). public let includeHeaders: Bool /// Include running footers in extraction output. /// /// - PDF: Disables bottom-margin furniture stripping and prevents the layout /// model from treating `PageFooter`-classified regions as furniture. /// - DOCX: Includes document footers in text output. /// - RTF/ODT: Footers already included; this is a no-op when true. /// - HTML/EPUB: Keeps `